- Home /
Question by
claudekennilol · Jul 12, 2011 at 10:30 PM ·
osstring formatting
os specific paths in strings?
I've got this for my path
private string outputLocation = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
private string macOut = @"/ArtifactExampleXML.xml";
private string winOut = @"\ArtifactExampleXML.xml";
and this in my constructor
public XMLParser(){ if (SystemInfo.operatingSystem.Contains("Mac")) outputLocation = outputLocation + macOut; else outputLocation = outputLocation + winOut; }There's got to be a way around this and just have it know which way the string should be formatted.. Can someone shed some light on my situation?
Comment
Best Answer
Answer by Waz · Jul 12, 2011 at 11:08 PM
Windows works fine with / so just use that.
Thanks, I just realized what you meant, I tried that out and it works great.
Your answer
Follow this Question
Related Questions
os specific paths in strings? 0 Answers
How would I make an Operating System? 1 Answer
Preformance difference between build on macOS and Windows 0 Answers
String format not working 1 Answer