- Home /
pathname slash/backslash
Hello,
after building my game (windows standalone), it doesn't work because there are information and data missing which are in the executablename_Data/Resources folder. I try to get access to this data with Application.dataPath + "/Resources/fileName.xml. It works only if i copy&paste the xml manually into this folder after the build.
How to solve this problem: "Note that the string returned on a PC will use a forward slash as a folder separator." http://unity3d.com/support/documentation/ScriptReference/Application-dataPath.html
The path I get with application.dataPath is like: C:/.../.../executablename_Data but on windows it has to be C:\...\...\\executablename_Data
yes my getfile path name is this. i have to replace them i guess:
E:/Users/Tuone/Downloads/CharacterCustomization/CharacterCustomization/Assets\DressingroomExample\dressing_room\textures\wallpaper.tga
code: this would fix it;
retrievepath = retrievepath.Replace( "\\" , "/" );
Answer by Eric5h5 · Sep 19, 2011 at 05:06 PM
You don't need to use backslashes even on Windows, just forward slashes.
In my reader script I have a Debug.Log if the file can't be opened: "Error opening: " + pathToFile + " for reading." And i get this message in the output.log with the pathname in it. With forward slashes. Error opening: C:/.../.../.../... for reading. But if i click on the file and check the path, it's with backslashes. Is this the problem why it can't open the file?