@@ -60,7 +60,7 @@ namespace Internal
6060 return path;
6161 }
6262
63- bool FileExists (const std::string& path, bool & outIsDir)
63+ bool FileOrDirectoryExists (const std::string& path, bool & outIsDir)
6464 {
6565 tinydir_file inputFile;
6666
@@ -92,25 +92,49 @@ namespace Internal
9292 return scriptDirectory;
9393 }
9494
95- std::string GetFileNameWithoutExtension (const std::string& filePath)
95+ std::string GetFileNameWithExtension (const std::string& filePath)
9696 {
9797 char separator = GetFileSystemSeparator ();
9898
99- std::size_t lastDotIndex = filePath.rfind (" ." );
10099 std::size_t lastSlashIndex = filePath.rfind (separator);
101100
102101 std::string filename;
102+ if (lastSlashIndex != std::string::npos)
103+ filename = filename.substr (lastSlashIndex + 1 );
104+
105+ return filename;
106+ }
107+
108+ std::string GetFileNameWithoutExtension (const std::string& filePath)
109+ {
110+ std::string filename = GetFileNameWithExtension (filePath);
111+
112+ char separator = GetFileSystemSeparator ();
113+
114+ std::size_t lastDotIndex = filePath.rfind (" ." );
115+
103116 if (lastDotIndex == std::string::npos)
104117 filename = filePath;
105118 else
106119 filename = filePath.substr (0 , lastDotIndex);
107120
108- if (lastSlashIndex != std::string::npos)
109- filename = filename.substr (lastSlashIndex + 1 );
110-
111121 return filename;
112122 }
113123
124+ std::string GetFileExtension (const std::string& filePath)
125+ {
126+ std::size_t lastDotIndex = filePath.rfind (" ." );
127+ std::string extension;
128+
129+ if (lastDotIndex == std::string::npos)
130+ extension = " " ;
131+ else
132+ extension = filePath.substr (lastDotIndex+1 );
133+
134+ return extension;
135+ }
136+
137+
114138 std::vector<std::string> GetPlatformNames ()
115139 {
116140 #ifdef _WIN32
0 commit comments