BUG: fixes for mingw and CMakesetup with spaces in the source directory
This commit is contained in:
parent
4fb678e40d
commit
3e2e0d5d63
|
@ -131,8 +131,13 @@ std::string ConvertToWindowsPath(const char* path)
|
||||||
// Remove the "" around it (if any) since it's an output path for
|
// Remove the "" around it (if any) since it's an output path for
|
||||||
// the shell. If another shell-oriented feature is not designed
|
// the shell. If another shell-oriented feature is not designed
|
||||||
// for a GUI use, then we are in trouble.
|
// for a GUI use, then we are in trouble.
|
||||||
|
// save the value of the force to unix path option
|
||||||
|
bool saveForce = cmSystemTools::GetForceUnixPaths();
|
||||||
|
// make sure we get windows paths no matter what for the GUI
|
||||||
|
cmSystemTools::SetForceUnixPaths(false);
|
||||||
std::string s = cmSystemTools::ConvertToOutputPath(path);
|
std::string s = cmSystemTools::ConvertToOutputPath(path);
|
||||||
|
// now restore the force unix path to its previous value
|
||||||
|
cmSystemTools::SetForceUnixPaths(saveForce);
|
||||||
if (s.size())
|
if (s.size())
|
||||||
{
|
{
|
||||||
std::string::iterator i = s.begin();
|
std::string::iterator i = s.begin();
|
||||||
|
|
|
@ -253,6 +253,11 @@ public:
|
||||||
{
|
{
|
||||||
s_ForceUnixPaths = v;
|
s_ForceUnixPaths = v;
|
||||||
}
|
}
|
||||||
|
static bool GetForceUnixPaths()
|
||||||
|
{
|
||||||
|
return s_ForceUnixPaths;
|
||||||
|
}
|
||||||
|
|
||||||
// ConvertToOutputPath use s_ForceUnixPaths
|
// ConvertToOutputPath use s_ForceUnixPaths
|
||||||
static std::string ConvertToOutputPath(const char* path);
|
static std::string ConvertToOutputPath(const char* path);
|
||||||
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
|
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
|
||||||
|
|
|
@ -708,7 +708,14 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
|
||||||
kwsys_stl::string::size_type pos = 0;
|
kwsys_stl::string::size_type pos = 0;
|
||||||
while((pos = path.find('\\', pos)) != kwsys_stl::string::npos)
|
while((pos = path.find('\\', pos)) != kwsys_stl::string::npos)
|
||||||
{
|
{
|
||||||
path[pos] = '/';
|
// make sure we don't convert an escaped space to a unix slash
|
||||||
|
if(pos < path.size()-2)
|
||||||
|
{
|
||||||
|
if(path[pos+1] != ' ')
|
||||||
|
{
|
||||||
|
path[pos] = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
// Remove all // from the path just like most unix shells
|
// Remove all // from the path just like most unix shells
|
||||||
|
|
Loading…
Reference in New Issue