diff options
author | Matthias Kortstiege <vdrfan@xbmc.org> | 2014-06-07 11:43:44 +0200 |
---|---|---|
committer | Matthias Kortstiege <vdrfan@xbmc.org> | 2014-06-08 19:22:40 +0200 |
commit | 791903b4f42a0dda78adc4d83cf608392f8928a9 (patch) | |
tree | 0611074212ec108eea9caf31fec5521893b8840d | |
parent | 1d00ba40fe00a8074024f4d12c15de29774d83d1 (diff) |
[posixdirectory] fixups
-rw-r--r-- | xbmc/filesystem/posix/PosixDirectory.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/xbmc/filesystem/posix/PosixDirectory.cpp b/xbmc/filesystem/posix/PosixDirectory.cpp index e60c6f9a1a..60995f10a1 100644 --- a/xbmc/filesystem/posix/PosixDirectory.cpp +++ b/xbmc/filesystem/posix/PosixDirectory.cpp @@ -21,9 +21,11 @@ #if defined(TARGET_POSIX) #include "PosixDirectory.h" +#include "utils/AliasShortcutUtils.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "FileItem.h" +#include "linux/XTimeUtils.h" #include <dirent.h> #include <sys/stat.h> @@ -37,8 +39,13 @@ CPosixDirectory::CPosixDirectory(void) CPosixDirectory::~CPosixDirectory(void) {} -bool CPosixDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) +bool CPosixDirectory::GetDirectory(const CStdString& strPath1, CFileItemList &items) { + CStdString strPath = strPath1; + + if (IsAliasShortcut(strPath)) + TranslateAliasShortcut(strPath); + const char* root = strPath; struct dirent* entry; DIR *dir = opendir(root); @@ -106,7 +113,14 @@ bool CPosixDirectory::Create(const char* strPath) if (!strPath || !*strPath) return false; - return (mkdir(strPath, 0755) == 0 || errno == EEXIST); + if (mkdir(strPath, 0755) != 0) + { + if (errno == EEXIST) + return Exists(strPath); + else + return false; + } + return true; } bool CPosixDirectory::Remove(const char* strPath) @@ -114,7 +128,10 @@ bool CPosixDirectory::Remove(const char* strPath) if (!strPath || !*strPath) return false; - return (rmdir(strPath) == 0); + if (rmdir(strPath) == 0) + return true; + + return !Exists(strPath); } bool CPosixDirectory::Exists(const char* strPath) |