tblancher / pymazon

Automatically exported from code.google.com/p/pymazon
Other
0 stars 0 forks source link

Make "Show Downloads" open with the default file browser #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I find that opening the Downloads folder in a webbrowser (as the current code 
specifies) is kind of an odd way to do this. From my brief Googling I realize 
there isn't a perfectly elegant way to use the file browser, but there are a 
few ways that are not bad.

I've attached a diff for a quick way to implement the desired behavior. Since I 
only run a Linux environment I haven't tested OSX or Windows, but my 
web-sources tell me that this is the proper way to implement the code on those 
platforms. I apologize that I cannot cite those sources, but I patched this on 
my local machine months ago and am only now submitting my suggestion

Original issue reported on code.google.com by jsphs...@gmail.com on 15 Apr 2012 at 7:52

Attachments:

GoogleCodeExporter commented 8 years ago
Think there's a slight bug in the patch in that is has 2 Mac options and no 
Windows :)

I suggest instead:

        if sys.platform == 'linux2':
          subprocess.Popen(['xdg-open', settings.save_dir])
        elif sys.platform == 'darwin':
          subprocess.Popen(['open', settings.save_dir])
        elif sys.platform == 'win32':
          os.startfile(settings.save_dir)
        else:
          webbrowser.open(settings.save_dir)

Not sure about 64-bit Windows's ID.

Original comment by fnx...@gmail.com on 28 Jul 2012 at 10:51

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Well, would you look at that. OK, looks like you've got it.

The Python documentation (http://docs.python.org/library/sys.html#sys.platform) 
seems to suggest that the ID for windows is 'win32' regardless of the platform.

(Edit: damn wikisyntax)

Original comment by jsphs...@gmail.com on 8 Oct 2012 at 10:34