From add823a749e722ffda90eaacfeafcac974358434 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 15 Aug 2010 07:48:46 -0400 Subject: [PATCH] Add "or '.'" after dirname() calls in hooke.command_stack and .playlist. Because >>> import os.path >>> os.path.dirname('some-file') '' >>> os.path.dirname('some-file') or '.' '.' and >>> import os >>> os.makedirs('') Traceback (most recent call last): ... OSError: [Errno 2] No such file or directory: '' --- hooke/command_stack.py | 2 +- hooke/playlist.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hooke/command_stack.py b/hooke/command_stack.py index 9b2dcd7..c116473 100644 --- a/hooke/command_stack.py +++ b/hooke/command_stack.py @@ -154,7 +154,7 @@ class FileCommandStack (CommandStack): """Saves the command stack to `path`. """ self.set_path(path) - dirname = os.path.dirname(self.path) + dirname = os.path.dirname(self.path) or '.' if makedirs == True and not os.path.isdir(dirname): os.makedirs(dirname) with open(self.path, 'w') as f: diff --git a/hooke/playlist.py b/hooke/playlist.py index 352617c..ee58609 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -370,7 +370,7 @@ class FilePlaylist (Playlist): """Saves the playlist in a XML file. """ self.set_path(path) - dirname = os.path.dirname(self.path) + dirname = os.path.dirname(self.path) or '.' if makedirs == True and not os.path.isdir(dirname): os.makedirs(dirname) with open(self.path, 'w') as f: -- 2.26.2