diff options
author | Jesús <heckyel@hyperbola.info> | 2020-06-01 22:36:26 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-01 22:36:26 -0500 |
commit | b32174e1f1cad446cd70e0c31842060cace02e6d (patch) | |
tree | 6aa4cb5ec27d168017f49d7f0b731ff177d97375 /lvc/openfiles.py | |
parent | e2becdc4e1e72e4dc95ebddc6b6ea4ae72c45023 (diff) | |
download | librevideoconverter-b32174e1f1cad446cd70e0c31842060cace02e6d.tar.lz librevideoconverter-b32174e1f1cad446cd70e0c31842060cace02e6d.tar.xz librevideoconverter-b32174e1f1cad446cd70e0c31842060cace02e6d.zip |
fix openfiles
Diffstat (limited to 'lvc/openfiles.py')
-rw-r--r-- | lvc/openfiles.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lvc/openfiles.py b/lvc/openfiles.py index ef6710a..377f49a 100644 --- a/lvc/openfiles.py +++ b/lvc/openfiles.py @@ -10,26 +10,42 @@ import sys # http://stackoverflow.com/questions/6631299/python-opening-a-folder-in-explorer-nautilus-mac-thingie def check_kde(): - return os.environ.get("KDE_FULL_SESSION", None) != None + return os.environ.get("KDE_FULL_SESSION", None) is not None + + +def check_xorg(): + return os.environ.get("XDG_SESSION_ID", None) is not None + def _open_path_osx(path): subprocess.call(['open', '--', path]) + def _open_path_kde(path): - subprocess.call(["kfmclient", "exec", "file://" + path]) # kfmclient is part of konqueror + # kfmclient is part of konqueror + subprocess.call(["kfmclient", "exec", "file://" + path]) + + +def _open_path_xorg(path): + subprocess.call(['xdg-open', path]) + def _open_path_gnome(path): - subprocess.call(["gnome-open",'--'. path]) + subprocess.call(['gnome-open', '--', path]) + def _open_path_windows(path): subprocess.call(['explorer', path]) + def _open_path(path): if sys.platform == 'darwin': _open_path_osx(path) elif sys.platform == 'linux2': if check_kde(): _open_path_kde(path) + elif check_xorg(): + _open_path_xorg(path) else: _open_path_gnome(path) elif sys.platform == 'win32': @@ -37,6 +53,7 @@ def _open_path(path): else: logging.warn("unknown platform: %s", sys.platform) + def reveal_folder(path): """Show a folder in the desktop shell (finder/explorer/nautilous, etc).""" logging.info("reveal_folder: %s", path) |