Skip to content

Commit

Permalink
Fix infinite loop in file dialog
Browse files Browse the repository at this point in the history
Update gitignore for vi swp files
  • Loading branch information
Timothy Baldock committed Jan 29, 2012
1 parent 0f7faa7 commit 0a0d3f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
.DS_Store
*.pyc
*.swp
9 changes: 9 additions & 0 deletions tcui/fileTextBox.py
Expand Up @@ -45,9 +45,14 @@ def filePickerDialog(self, path1, path2=None, dialogText="", dialogFilesAllowed=

# If path directory component empty, use passed-in "last" path as starting location
# rather than using default starting location

if path1 == u"" and config.last_save_path != u"" and os.path.exists(config.last_save_path):
a = config.last_save_path

debug(u"Path a is: %s and path b is: %s" % (a, b))

# Check path components exist

# Show the dialog
pickerDialog = wx.FileDialog(self.parent, dialogText,
a, b, dialogFilesAllowed, dialogFlags)
Expand Down Expand Up @@ -159,7 +164,11 @@ def existingPath(self, p):
if os.path.split(os.path.split(p)[0])[1] != "":
p = os.path.split(p)[0]
while not os.path.exists(p):
q = p
p = os.path.split(p)[0]
# Avoid infinite loop
if p == q:
return u""
return p

def comparePaths(self, p1, p2):
Expand Down

0 comments on commit 0a0d3f9

Please sign in to comment.