diff --git a/plyer/facades/storagepath.py b/plyer/facades/storagepath.py index 7445a563..ad961f62 100644 --- a/plyer/facades/storagepath.py +++ b/plyer/facades/storagepath.py @@ -27,9 +27,11 @@ >>> from plyer import storagepath >>> storagepath.get_application_dir() + ''' + class StoragePath: ''' StoragePath facade. @@ -101,12 +103,17 @@ def get_application_dir(self): Get the path of the directory holding application files. ''' return self._get_application_dir() + + def get_desktop_dir(self): + ''' + Get the path of the directory holding application files. + ''' + return self._get_desktop_dir() - # private def _get_home_dir(self): raise NotImplementedError() - + def _get_external_storage_dir(self): raise NotImplementedError() @@ -133,3 +140,6 @@ def _get_pictures_dir(self): def _get_application_dir(self): raise NotImplementedError() + + def _get_desktop_dir(self): + raise NotImplementedError() \ No newline at end of file diff --git a/plyer/platforms/ios/storagepath.py b/plyer/platforms/ios/storagepath.py index cd8bbc39..41d6b8e2 100644 --- a/plyer/platforms/ios/storagepath.py +++ b/plyer/platforms/ios/storagepath.py @@ -58,5 +58,6 @@ def _get_application_dir(self): UTF8String() + def instance(): return iOSStoragePath() diff --git a/plyer/platforms/macosx/storagepath.py b/plyer/platforms/macosx/storagepath.py index 027b04ee..9714a469 100644 --- a/plyer/platforms/macosx/storagepath.py +++ b/plyer/platforms/macosx/storagepath.py @@ -15,6 +15,8 @@ NSMoviesDirectory = 17 NSMusicDirectory = 18 NSPicturesDirectory = 19 +NSDesktopDirectory = 12 + class OSXStoragePath(StoragePath): @@ -57,6 +59,14 @@ def _get_application_dir(self): NSApplicationDirectory, 1 ).firstObject().absoluteString.UTF8String() + def _get_desktop_dir(self): + return self.defaultManager.URLsForDirectory_inDomains_( + NSDesktopDirectory, 1).firstObject().absoluteString.\ + UTF8String() + + + + def instance(): return OSXStoragePath() diff --git a/plyer/tests/test_storagepath.py b/plyer/tests/test_storagepath.py index 35b8139e..8272fde4 100644 --- a/plyer/tests/test_storagepath.py +++ b/plyer/tests/test_storagepath.py @@ -41,6 +41,7 @@ def test_storagepath_macosx(self): self.assertIn(path_format, storagepath.get_music_dir()) self.assertIn(path_format, storagepath.get_pictures_dir()) self.assertIn(path_format, storagepath.get_application_dir()) + self.assertIn(path_format, storagepath.get_desktop_dir()) @PlatformTest('win') def test_storagepath_windows(self):