hydrus/hydrus/client/ClientPaths.py

37 lines
879 B
Python
Raw Normal View History

2020-05-20 21:36:02 +00:00
import os
import webbrowser
2020-04-22 21:00:35 +00:00
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
2018-05-09 20:23:00 +00:00
2018-06-06 21:27:02 +00:00
def DeletePath( path, always_delete_fully = False ):
2018-05-16 20:09:50 +00:00
2018-06-06 21:27:02 +00:00
if HC.options[ 'delete_to_recycle_bin' ] == True and not always_delete_fully:
2018-05-16 20:09:50 +00:00
HydrusPaths.RecyclePath( path )
else:
HydrusPaths.DeletePath( path )
2018-05-09 20:23:00 +00:00
def LaunchPathInWebBrowser( path ):
LaunchURLInWebBrowser( 'file:///' + path )
def LaunchURLInWebBrowser( url ):
web_browser_path = HG.client_controller.new_options.GetNoneableString( 'web_browser_path' )
if web_browser_path is None:
webbrowser.open( url )
else:
HydrusPaths.LaunchFile( url, launch_path = web_browser_path )