src/eric7/SystemUtilities/FileSystemUtilities.py

branch
eric7
changeset 10397
f60464a5f7ea
parent 10396
2f72e9330af2
child 10439
21c28b0f9e41
equal deleted inserted replaced
10396:2f72e9330af2 10397:f60464a5f7ea
738 @return flag indicating a successful start of the associated application 738 @return flag indicating a successful start of the associated application
739 @rtype bool 739 @rtype bool
740 """ 740 """
741 filePath = str(filePath) 741 filePath = str(filePath)
742 742
743 if OSUtilities.isWindowsPlatform(): 743 with contextlib.suppress(OSError):
744 return os.startfile(filePath) # secok 744 if OSUtilities.isWindowsPlatform():
745 745 os.startfile(filePath) # secok
746 elif OSUtilities.isMacPlatform(): 746 return True
747 return subprocess.call(("open", filePath)) # secok 747
748 748 elif OSUtilities.isMacPlatform():
749 elif OSUtilities.isLinuxPlatform() or OSUtilities.isFreeBsdPlatform(): 749 return subprocess.call(("open", filePath)) == 0 # secok
750 return subprocess.call(("xdg-open", filePath)) # secok 750
751 751 elif OSUtilities.isLinuxPlatform() or OSUtilities.isFreeBsdPlatform():
752 else: 752 return subprocess.call(("xdg-open", filePath)) == 0 # secok
753 # unsupported platform 753
754 return False 754 # unsupported platform or OSError
755 return False
755 756
756 757
757 ################################################################################ 758 ################################################################################
758 ## Functions below handle (MicroPython) device and remote file names. 759 ## Functions below handle (MicroPython) device and remote file names.
759 ################################################################################ 760 ################################################################################

eric ide

mercurial