summaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r--lib/Support/Windows/Path.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index cc68b9f3ab..9100739ae0 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -694,7 +694,8 @@ Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// If it doesn't exist, we're done.
- if (!exists())
+ bool Exists;
+ if (fs::exists(path, Exists) || !Exists)
return false;
char *pathname = reinterpret_cast<char *>(_alloca(path.length()+3));
@@ -868,7 +869,8 @@ CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg) {
bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
- if (reuse_current && !exists())
+ bool Exists;
+ if (reuse_current && (fs::exists(path, Exists) || !Exists))
return false; // File doesn't exist already, just use it!
// Reserve space for -XXXXXX at the end.
@@ -885,7 +887,7 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
if (++FCounter > 999999)
FCounter = 0;
path = FNBuffer;
- } while (exists());
+ } while (!fs::exists(path, Exists) && Exists);
return false;
}