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 ################################################################################ |