more correct absolute path detection

[?]
Sep 11, 2022, 3:31 PM
NFI42KGXEHTNACH2CATBLJIAXJYNV2C3QBPR2ORPJZKOVEREVM7QC

Dependencies

  • [2] OI4FPFIN support drawings in the source editor
  • [3] ZJOSQFN6 bugfix: path munging on Windows
  • [4] CQYKYJJU remember window positions across restart/ctrl+e
  • [5] X3CQLBTR set window title within each app
  • [6] KKMFQDR4 editing source code from within the app
  • [*] VHQCNMAR several more modules

Change contents

  • edit in source_file.lua at line 202
    [2.17838]
    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
  • replacement in source.lua at line 260
    [4.173955][3.114:297]()
    local os_path_separator = package.config:sub(1,1)
    if filename:sub(1,1) ~= os_path_separator then
    filename = love.filesystem.getWorkingDirectory()..os_path_separator..filename
    [4.173955]
    [4.174094]
    if is_relative_path(filename) then
    filename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
  • replacement in run.lua at line 144
    [4.182611][3.302:485]()
    local os_path_separator = package.config:sub(1,1)
    if filename:sub(1,1) ~= os_path_separator then
    filename = love.filesystem.getWorkingDirectory()..os_path_separator..filename
    [4.182611]
    [4.182750]
    if is_relative_path(filename) then
    filename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
  • edit in file.lua at line 183
    [8.18211]
    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