Browse Source

Introjucer: file separator character fix on windows.

tags/2021-05-28
jules 12 years ago
parent
commit
a4e87ef28a
3 changed files with 12 additions and 10 deletions
  1. +3
    -4
      extras/Introjucer/Source/Project/jucer_Project.cpp
  2. +8
    -6
      extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp
  3. +1
    -0
      extras/Introjucer/Source/Utility/jucer_FileHelpers.h

+ 3
- 4
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -293,13 +293,12 @@ File Project::resolveFilename (String filename) const
if (filename.isEmpty())
return File::nonexistent;
filename = replacePreprocessorDefs (getPreprocessorDefs(), filename)
.replaceCharacter ('\\', '/');
filename = replacePreprocessorDefs (getPreprocessorDefs(), filename);
if (FileHelpers::isAbsolutePath (filename))
return File::createFileWithoutCheckingPath (filename); // (avoid assertions for windows-style paths)
return File::createFileWithoutCheckingPath (FileHelpers::currentOSStylePath (filename)); // (avoid assertions for windows-style paths)
return getFile().getSiblingFile (filename);
return getFile().getSiblingFile (FileHelpers::currentOSStylePath (filename));
}
String Project::getRelativePathForFile (const File& file) const


+ 8
- 6
extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp View File

@@ -102,14 +102,16 @@ namespace FileHelpers
return false;
}
String unixStylePath (const String& path)
{
return path.replaceCharacter ('\\', '/');
}
String unixStylePath (const String& path) { return path.replaceCharacter ('\\', '/'); }
String windowsStylePath (const String& path) { return path.replaceCharacter ('/', '\\'); }
String windowsStylePath (const String& path)
String currentOSStylePath (const String& path)
{
return path.replaceCharacter ('/', '\\');
#if JUCE_WINDOWS
return windowsStylePath (path);
#else
return unixStylePath (path);
#endif
}
bool isAbsolutePath (const String& path)


+ 1
- 0
extras/Introjucer/Source/Utility/jucer_FileHelpers.h View File

@@ -41,6 +41,7 @@ namespace FileHelpers
String unixStylePath (const String& path);
String windowsStylePath (const String& path);
String currentOSStylePath (const String& path);
bool shouldPathsBeRelative (String path1, String path2);
bool isAbsolutePath (const String& path);


Loading…
Cancel
Save