Skip to content

Commit

Permalink
[#293] Link to files fails with ugly error message on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
quicklizard99 committed May 2, 2016
1 parent 9b393b0 commit fee5897
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ This is an overview of major changes. Refer to the git repository for a full log

Version 0.1.29
-------------
- Fixed #293 - Link to files fails with ugly error message on Windows

Version 0.1.28
-------------
Expand Down
15 changes: 5 additions & 10 deletions inselect/gui/info_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import sys

from PySide.QtCore import Qt, QProcessEnvironment
from PySide.QtCore import Qt
from PySide.QtGui import QWidget, QFormLayout, QLabel, QGroupBox, QVBoxLayout

from inselect.lib.utils import format_dt_display
Expand All @@ -17,16 +17,11 @@ def reveal_path(path):
"""Shows path in Finder (on Mac) or in Explorer (on Windows)
"""
# http://stackoverflow.com/a/3546503
path = path.resolve()
if sys.platform.startswith("win"):
explorer = QProcessEnvironment.systemEnvironment().searchInPath("explorer.exe")
if not explorer:
raise ValueError('Explorer could not be located')
else:
if not path.is_dir():
arg = u"/select,{0}".format(path)
else:
arg = unicode(path)
subprocess.check_call([explorer, arg])
res = subprocess.call(["explorer.exe", u"/select,{0}".format(path)])
if 1 != res:
raise ValueError('Unexpected exit code [{0}]'.format(res))
elif 'Darwin' == platform.system():
reveal = u'tell application "Finder" to reveal POSIX file "{0}"'
activate = u'tell application "Finder" to activate "{0}"'
Expand Down

0 comments on commit fee5897

Please sign in to comment.