migrate old settings, attempt #3
[?]
Sep 19, 2022, 7:53 AM
A23MMLJHXQOVDZHJCPCCP4SIFXTB7HXJMCCDAM2I7Q7BAIXMAYBACDependencies
- [2]
NFI42KGXmore correct absolute path detection - [3]
S3PNFXTBhandle missing cursors in settings - [4]
SDO4DHNUsource: load cursor position from settings - [5]
KKMFQDR4editing source code from within the app - [6]
AOZX2G5Fsource: no commandline args
Change contents
- edit in source_file.lua at line 218
endfunction dirname(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn path:match('.*/') or './'elseif os_path_separator == '\\' thenreturn path:match('.*[/\\]') or './'elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')endendfunction test_dirname()check_eq(dirname('a/b'), 'a/', 'F - test_dirname')check_eq(dirname('x'), './', 'F - test_dirname/current')endfunction basename(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn string.gsub(path, ".*/(.*)", "%1")elseif os_path_separator == '\\' thenreturn string.gsub(path, ".*[/\\](.*)", "%1")elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')end - edit in source_file.lua at line 248[2.503]
function empty(h)for _,_ in pairs(h) doreturn falseendreturn trueend - replacement in source.lua at line 89
Editor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1if File_navigation.cursors[Editor_state.filename] thenEditor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1elseEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}end - edit in source.lua at line 137
Editor_state.filename = basename(Editor_state.filename) -- migrate settings that used full paths; we now support only relative paths within the app