forked from chrislo27/RhythmHeavenRemixEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file explorer not opening sometimes on Windows
- Loading branch information
Showing
7 changed files
with
41 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/src/main/kotlin/io/github/chrislo27/toolboks/util/gdxutils/URIUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.github.chrislo27.toolboks.util.gdxutils | ||
|
||
import com.badlogic.gdx.Net | ||
import com.badlogic.gdx.files.FileHandle | ||
import java.awt.Desktop | ||
import java.io.File | ||
import java.net.URI | ||
|
||
|
||
fun Net.openFileExplorer(absPath: String): Boolean { | ||
return try { | ||
Desktop.getDesktop().browse(URI("file:///${absPath.replace("\\", "/")}")) | ||
true | ||
} catch (t: Throwable) { | ||
t.printStackTrace() | ||
false | ||
} | ||
} | ||
|
||
fun Net.openFileExplorer(file: File): Boolean = openFileExplorer(file.absolutePath) | ||
|
||
fun Net.openFileExplorer(fileHandle: FileHandle): Boolean = openFileExplorer(fileHandle.file()) |