c# get part of directory ?

  • Thread starter Thread starter elfenliedtopfan55
  • Start date Start date
E

elfenliedtopfan55

Guest
ok i have this url

ModelPath=A:\Steam\steamapps\common\Call of Duty Black Ops III\model_export\elfenliedtopfan5_weapons\mw_2019\mp7


and what i want to do is remove everything before \model_export

A:\Steam\steamapps\common\Call of Duty Black Ops III

so that part i dont want the rest i want to keep i have tried this

public void splitmodelpath()
{
String path = elfenliedtopfan5progsettings.Read("ModelPath","ModelPaths");
String[] extract = Regex.Split(path, "xmodel_bin");
String main = extract[0].Remove(0,67);
string mainext = main;
string correctString = mainext.Replace("\\", "\\\\");
elfenliedtopfan5progsettings.Write("ModelPathGDT", correctString + "\\\\","ModelGDT");
}


but its not the best way of doing it as some people can have different size filenames for the folders so it cuts off on a user pc

so i wonder if there is a way of splitting it more officiantly


thanks in advance elfenliedtopfan5

Continue reading...
 
Back
Top