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

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