-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix media storage with absolute local paths
- Loading branch information
Showing
4 changed files
with
39 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package eu.iamgio.quarkdown.util | ||
|
||
import java.io.File | ||
import kotlin.io.path.Path | ||
|
||
/** | ||
* Utility methods for file-based operations. | ||
*/ | ||
object IOUtils { | ||
/** | ||
* Resolves a [File] located in [path], either relative or absolute. | ||
* If the path is relative, the location is determined from the [workingDirectory]. | ||
* @param path path of the file, either relative or absolute | ||
* @param workingDirectory directory from which the file is resolved, in case the path is relative | ||
* @return a [File] instance of the file | ||
*/ | ||
fun resolvePath( | ||
path: String, | ||
workingDirectory: File?, | ||
): File = | ||
if (workingDirectory != null && !Path(path).isAbsolute) { | ||
File(workingDirectory, path) | ||
} else { | ||
File(path) | ||
} | ||
} |
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