Skip to main content

GetScriptFilePath

This function was added in DSL 8

Description

Get a full path given a relative path.

Usually not needed, as most DSL functions expect the relative path.

filename is a relative path to the file.

A fullpath in this context is not a full system path, but rather just a path that is relative to Bully.exe rather than the running collection.

warning

The parameter filename is required in newer version of DSL, will throw an error if not provided.

Previously, this was optional.

function GetScriptFilePath(filename) --[[ ... ]] end

Parameters

  • filename: string - The relative path to the file. If not provided.

Return Values

  • fullpath: string - The full path to the file, relative to Bully.exe.

Example

Standalone Collection

_derpy_script_loader/scripts/my_mod.lua

local fullPath1 = GetScriptFilePath("file1.txt")
print(fullPath1) --> _derpy_script_loader/scripts/file1.txt

local fullPath2 = GetScriptFilePath("folder2/file2.txt")
print(fullPath2) --> _derpy_script_loader/scripts/folder2/file2.txt

Normal Collection

_derpy_script_loader/scripts/MyMod/main.lua

local fullPath1 = GetScriptFilePath("file1.txt")
print(fullPath1) --> _derpy_script_loader/scripts/MyMod/file1.txt

local fullPath2 = GetScriptFilePath("folder2/file2.txt")
print(fullPath2) --> _derpy_script_loader/scripts/MyMod/folder2/file2.txt