mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 20:03:58 +02:00
- bugfix for windows users 7z extraction
This commit is contained in:
@@ -165,7 +165,7 @@ void restoreVideoMode(bool exitingApp=false);
|
|||||||
bool StartsWith(const std::string &str, const std::string &key);
|
bool StartsWith(const std::string &str, const std::string &key);
|
||||||
bool EndsWith(const string &str, const string& key);
|
bool EndsWith(const string &str, const string& key);
|
||||||
|
|
||||||
void endPathWithSlash(string &path);
|
void endPathWithSlash(string &path, bool requireOSSlash=false);
|
||||||
void trimPathWithStartingSlash(string &path);
|
void trimPathWithStartingSlash(string &path);
|
||||||
void updatePathClimbingParts(string &path);
|
void updatePathClimbingParts(string &path);
|
||||||
|
|
||||||
|
@@ -469,13 +469,15 @@ bool EndsWith(const string &str, const string& key)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void endPathWithSlash(string &path) {
|
void endPathWithSlash(string &path,bool requireOSSlash) {
|
||||||
if(EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
|
if(EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
|
||||||
|
string seperator = "/";
|
||||||
|
if(requireOSSlash == true) {
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
path += "\\";
|
seperator = "\\";
|
||||||
#else
|
|
||||||
path += "/";
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
path += seperator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1663,10 +1665,21 @@ string replaceAll(string& context, const string& from, const string& to) {
|
|||||||
|
|
||||||
string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand,
|
string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand,
|
||||||
string fileArchiveExtractCommandParameters, string outputpath, string archivename) {
|
string fileArchiveExtractCommandParameters, string outputpath, string archivename) {
|
||||||
|
string parsedOutputpath = outputpath;
|
||||||
|
string parsedArchivename = archivename;
|
||||||
|
|
||||||
|
// This is required for execution on win32
|
||||||
|
#if defined(WIN32)
|
||||||
|
replaceAll(parsedOutputpath, "\\\\", "\\");
|
||||||
|
replaceAll(parsedOutputpath, "/", "\\");
|
||||||
|
replaceAll(parsedArchivename, "\\\\", "\\");
|
||||||
|
replaceAll(parsedArchivename, "/", "\\");
|
||||||
|
#endif
|
||||||
|
|
||||||
string result = fileArchiveExtractCommand;
|
string result = fileArchiveExtractCommand;
|
||||||
result += " ";
|
result += " ";
|
||||||
string args = replaceAll(fileArchiveExtractCommandParameters, "{outputpath}", outputpath);
|
string args = replaceAll(fileArchiveExtractCommandParameters, "{outputpath}", parsedOutputpath);
|
||||||
args = replaceAll(args, "{archivename}", archivename);
|
args = replaceAll(args, "{archivename}", parsedArchivename);
|
||||||
result += args;
|
result += args;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user