You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
713 B

  1. package com.sothr.imagetools.ui.util
  2. import java.awt.Desktop
  3. import java.io.File
  4. import com.sothr.imagetools.engine.util.PropertiesService
  5. import grizzled.slf4j.Logging
  6. /**
  7. * Created by Drew Short on 8/31/2014.
  8. */
  9. object FileUtil extends Logging {
  10. def openInEditor(file: File) = {
  11. PropertiesService.OS.toLowerCase match {
  12. // Open file on windows
  13. case os if os.startsWith("windows") => Desktop.getDesktop.open(file)
  14. case os if os.startsWith("linux") => Runtime.getRuntime.exec(s"xdg-open ${file.getAbsolutePath}")
  15. case default => error(s"Do not know how to open editor for OS: ${PropertiesService.OS}, ${PropertiesService.OS_VERSION}, ${PropertiesService.OS_ARCH}")
  16. }
  17. }
  18. }