First, on Android the app dies in the file_drop event when starting up.
Error file.lua:21: Could not open file /external_primary/downloads/100606. Does not exist. Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: in function 'lines' file.lua:21: in function 'load_from_file' run.lua:109: in function 'file_drop' main.lua:117: in function <main.lua:115> app.lua:31: in function <app.lua:22> [C]: in function 'xpcall'
Just take out the event altogether; files are mostly meaningless on mobile.
P4AGA6W7EL5KMQGAWOS2EJR6ZB3IBQXDJDFUHDHUJL6R3LFM55QQC APX2PY6GAMJSUH7SFSMBFOQJBSAWLLOCKH4L4ZQP2VLHNEXJPREAC ORRSP7FVCHI2TF5GXBRGQYYJAA3JFYXZBM3T663BKSBV22FCZVCAC 73P42BEUHVANQI354DIUCS5YGMT755M7YHHKHPDPCLHCV3MPSZBQC KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC 2CK5QI7WA7M4IVSACFGOJYAIDKRUTZVMMPSFWEJTUNMWTN7AX4NAC OMLASW7KT5UWFXNGUFLLIKGDZ6OJETV5JAT53XKSNGMSML4WTOQQC X3CQLBTR7ICDAVFZZRLAWWJZI2SNZAMRUWW7O4R25DIKDUHL75CQC CE4LZV4TNXJT54CVGM3QANCBP42TMLMZWF2DBSMUYKAHILXIZEMQC BPWFKBXTKIRBJFWVZIUVCHGJTLBCR6EIMEHM3D3KOF5IULXCR5RQC UHB4GARJI5AB5UCDCZRFSCJNXGJSLU5DYGUGX5ITYEXI7Q43Z4CAC H3KWPK3GXISOB25HP3USPDJLY4Q3MYDDD77PPQ7OGBVEYG23D7JAC LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC YT5P6TO64XSMCZGTT4SVNFOWUN5ECNXTWCMFXN3YCDZUNH4H3IFAC PTDO2SOTXEI6FROZ2AVRFXSKKNKCRMPPTQSI5LWD45UVGDJPMSGQC 7VGDIPLCFDG3PVE4JH3WDKZ4A7PG5UYW7TLFFFOWN2JEUZYYTFJQC NEXUNNCF5PJC57XAMQGMSSYNI7MJ4ARWDY3HFGVYMGWG3MPHG7CQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC 5MR22SGZE5YDU5CAIY53GNJDA6HSWBPYPD6M3FRQ5ZUMCSKTYJRAC 46ASCE5K5QRO6BZNJPW4CJZCRVVG76S3GENIBGNGB352CP3DLDCQC AJB4LFRBMIRBEDWJ3OW7GQIMD2BZBVQ62GH4TE2FISWZKSAHRF4QC XSLCFVFHBXYPJDGOFULVB7UAWQY5CRDY4QKKHDXSZTSVLCHDL54QC function source.file_drop(file)-- first make sure to save edits on any existing fileif Editor_state.next_save thensave_to_disk(Editor_state)end-- clear the slate for the new fileEditor_state.filename = file:getFilename()file:open('r')Editor_state.lines = load_from_file(file)file:close()Text.redraw_all(Editor_state)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}-- keep a few blank lines around: https://merveilles.town/@akkartik/110084833821965708love.window.setTitle('lines.love - source')end
function test_drop_file()App.screen.init{width=Editor_state.left+300, height=300}Editor_state = edit.initialize_test_state()App.filesystem['foo'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'foo'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['foo']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)check_eq(#Editor_state.lines, 3, '#lines')check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')check_eq(Editor_state.lines[2].data, 'def', 'lines:2')check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')edit.draw(Editor_state)endfunction test_drop_file_saves_previous()App.screen.init{width=Editor_state.left+300, height=300}-- initially editing a file called foo that hasn't been saved to filesystem yetEditor_state.lines = load_array{'abc', 'def'}Editor_state.filename = 'foo'schedule_save(Editor_state)-- now drag a new file bar from the filesystemApp.filesystem['bar'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'bar'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['bar']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)-- filesystem now contains a file called foocheck_eq(App.filesystem['foo'], 'abc\ndef\n', 'check')end
endfunction run.file_drop(file)-- first make sure to save edits on any existing fileif Editor_state.next_save thensave_to_disk(Editor_state)end-- clear the slate for the new fileApp.initialize_globals()Editor_state.filename = file:getFilename()file:open('r')Editor_state.lines = load_from_file(file)file:close()Text.redraw_all(Editor_state)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}-- keep a few blank lines around: https://merveilles.town/@akkartik/110084833821965708love.window.setTitle('lines.love - '..Editor_state.filename)
endfunction App.filedropped(file)if Current_app == 'run' thenif run.file_drop then run.file_drop(file) endelseif Current_app == 'source' thenif source.file_drop then source.file_drop(file) endelseassert(false, 'unknown app "'..Current_app..'"')end