mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-02-16 16:40:55 +00:00
Fix update failing to install if the system temporary directory path starts with a lower-case letter.
Fix FileUtils::isRelative() to check if the upper-case version of the first character in the path is a letter.
This commit is contained in:
parent
df89da7ebd
commit
66bafb317f
3 changed files with 16 additions and 3 deletions
|
@ -461,7 +461,7 @@ std::string FileUtils::tempPath()
|
|||
bool startsWithDriveLetter(const char* path)
|
||||
{
|
||||
return strlen(path) >= 2 &&
|
||||
(path[0] >= 'A' && path[0] <= 'Z') &&
|
||||
(isalpha(path[0])) &&
|
||||
path[1] == ':';
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,21 @@ void TestFileUtils::testDirName()
|
|||
#endif
|
||||
}
|
||||
|
||||
void TestFileUtils::testIsRelative()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
TEST_COMPARE(FileUtils::isRelative("temp"),true);
|
||||
TEST_COMPARE(FileUtils::isRelative("D:/temp"),false);
|
||||
TEST_COMPARE(FileUtils::isRelative("d:/temp"),false);
|
||||
#else
|
||||
TEST_COMPARE(FileUtils::isRelative("/tmp"),false);
|
||||
TEST_COMPARE(FileUtils::isRelative("tmp"),true);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int,char**)
|
||||
{
|
||||
TestList<TestFileUtils> tests;
|
||||
tests.addTest(&TestFileUtils::testDirName);
|
||||
return TestUtils::runTest(tests);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,5 @@ class TestFileUtils
|
|||
{
|
||||
public:
|
||||
void testDirName();
|
||||
};
|
||||
void testIsRelative();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue