mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Workaround dir removal on current dir on windows
This commit is contained in:
parent
76ff756598
commit
2201a9b10c
@ -37,11 +37,15 @@ static inline bool changeDirectory(const UString & dir) {
|
||||
}
|
||||
|
||||
static inline void removeDirectory(const UString & dir) {
|
||||
_rmdir(dir.toLocal8Bit());
|
||||
int r = _rmdir(dir.toLocal8Bit());
|
||||
// Hack: unlike *nix, Windows does not permit deleting current directories.
|
||||
if (r < 0 && errno == EACCES && changeDirectory(dir + UString("/../"))) {
|
||||
_rmdir(dir.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
|
||||
static inline UString getAbsPath(const UString & path) {
|
||||
char abs[1024] = {};
|
||||
char abs[_MAX_PATH] = {};
|
||||
if (_fullpath(abs, path.toLocal8Bit(), sizeof(abs)))
|
||||
return UString(abs);
|
||||
return path;
|
||||
|
Loading…
Reference in New Issue
Block a user