Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

gtklib: native save dialog changes cwd

Interestingly, win32gui.GetSafeFileNameW changes the process
current working directory to the file save target and then returns
a relative file name. This is all kinds of bad, so we store cwd
and restore it after the dialog exits.

Changeset 15a5b3c1efa5

Parent 60d1cf6f932a

by Steve Borho

Changes to one file · Browse files at 15a5b3c1efa5 Showing diff from parent 60d1cf6f932a Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​gtklib.py Stacked
 
194
195
196
 
 
197
198
199
 
205
206
207
208
 
209
210
211
 
 
212
213
214
 
194
195
196
197
198
199
200
201
 
207
208
209
 
210
211
212
 
213
214
215
216
217
@@ -194,6 +194,8 @@
    def runWindows(self):   import win32gui, win32con, pywintypes + cwd = os.getcwd() + fname = None   try:   fname, customfilter, flags=win32gui.GetSaveFileNameW(   InitialDir=self.InitialDir, @@ -205,10 +207,11 @@
  CustomFilter='',   FilterIndex=1)   if fname: - return fname + fname = os.path.abspath(fname)   except pywintypes.error:   pass - return False + os.chdir(cwd) + return fname     def runCompatible(self):   file_save = gtk.FileChooserDialog(self.Title, None,