diff options
Diffstat (limited to 'file.lua')
-rw-r--r-- | file.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/file.lua b/file.lua index 6c460a9..72c114a 100644 --- a/file.lua +++ b/file.lua @@ -180,3 +180,20 @@ function load_drawing_from_array(iter, a, i) end return i, drawing end + +function is_absolute_path(path) + local os_path_separator = package.config:sub(1,1) + if os_path_separator == '/' then + -- POSIX systems permit backslashes in filenames + return path:sub(1,1) == '/' + elseif os_path_separator == '\\' then + local f = path:sub(1,1) + return f == '/' or f == '\\' + else + error('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"') + end +end + +function is_relative_path(path) + return not is_absolute_path(path) +end |