parseFilePath(path)
Last updated
// Resolve a simple file in the current directory
filePath = parseFilePath("config.json")
log filePath // Full absolute path to config.json
// Resolve a file in a subdirectory
imagePath = parseFilePath("assets/images/logo.png")
log imagePath // Full absolute path to the image// Resolve a path to a package file
packagePath = parseFilePath("packages/utils/helpers.osl")
log packagePath // Absolute path to the package file// Resolve a path before reading a file
configPath = parseFilePath("config/settings.json")
configData = open(configPath, ["data"])
// Work with the file data
settings = configData[1]// Get the directory containing a file
filePath = parseFilePath("documents/report.txt")
dirPath = filePath.replaceFirst(/\/[^\/]+$/, "")
// List files in that directory
files = listFiles(dirPath)