We can create them and see them on the file dialogs, but not yet load them back.
I want stashed files to remember the original filename. I think that implies the ability to add a note to them. But I don't yet know how to represent the note on disk.
And this creates cascading questions, like should editing a stash file continue to modify it or create a new version? How to create a new version? Should unstash copy or move?
NM2SILGFTYCIH7TDU3PU3U67J5KLZMDERTFLZQ3DA7WYGWPKEHKAC
JIERZ45WHGOT5J6GYXUPQ4LA4UAZ6ZNSU5NXTWVXQPMXBNKBUGJAC
GYFNSF33NGUAYEECESFKCSE4BYYFQGOF5XTQI4NQKXUUBTARHBVQC
JOY24JW6ELCMS44MMPC2YBO6DX5KJL6DPGNHQOOSGQLYZ5OLGW5AC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
FIUQJVL2MCC4VKKX7JBT6377TWIGPTUC5NXMUABV5JILB3ZDWZFAC
7QVNDHPEOY2NRHBON5XDSMLWZ5UXQB3SCEXIK3TZDZDRTAJHMTZAC
AZMYKWMHE3RTQ7Z7NTBK3H4YTZ46HQE2GHUY7WADMITC7UIVB5RQC
5RUFNRJOK3PXQKJTPDEN5K5PI67MGB25QUA44WOCCH2O5KHXT45QC
JV27LDDKKY57IEBWGBFPSHEARMOEGLBYGBJD27PDPTNWWYXA4T6AC
PO77NPCO2Y4RKIG6TJWOA44PKCAAZ2LXOIRBBOPTA3D4BUTHL6MQC
2IJLEJGT3AKHYV5CGFUXSIARMS5OR55JOQHOHCSX5FZ7CJJSDVBQC
add_files_to_dialog = function(contents, x,y, colorfn)
for _,filename in ipairs(contents) do
if filename:find(File_dialog_input_text) then
local w = Font:getWidth(filename) + 10
if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 then
x = Menu_left+10
y = y+Line_height+10
if y > Safe_height-Menu_bottom-10 then
break
end
end
styled_button(filename, x,y, function()
-- TODO: File_dialog_callback needs to somehow know to load stashed files.
File_dialog_callback(filename)
reset_file_dialog_state()
end,
--[[tooltip text]] nil,
colorfn(filename))
x = x+w+10
end
end
return y
end
directory_contents = function(directory)
contents = {}
local filenames = App.files(directory)
for _,filename in ipairs(filenames) do
local file_info = App.file_info(directory..filename)
if file_info.type == 'file' then
table.insert(contents, filename)
end
end
table.sort(contents)
return contents
end
press_stash_button = function()
-- disable local modifications to a file without deleting it or saving the pane
Show_menu = nil
stash_pane(Current_pane)
end
stash_pane = function(pane)
local src = Directory..pane.filename
local contents, error = love.filesystem.read(src)
if not contents then return print_to_output(error) end
love.filesystem.createDirectory(Stash_directory)
local dest = Stash_directory..pane.filename
local success, error = love.filesystem.write(dest, contents)
if not success then return print_to_output(error) end
love.filesystem.remove(src)
pane.stash_note = ''
end
Stash_directory = 'stash/'
stash_button = function(x,y, r)
return overflowable_button('stash', x, y, r, press_stash_button)
end
Stash_color = {r=0, g=0.3, b=0.6}
local x, y = Menu_left+10, Menu_bottom+10
for _,filename in ipairs(Directory_contents) do
if filename:find(File_dialog_input_text) then
local w = Font:getWidth(filename) + 10
if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 then
x = Menu_left+10
y = y+Line_height+10
if y > Safe_height-Menu_bottom-10 then
break
end
end
styled_button(filename, x,y, function()
File_dialog_callback(filename)
reset_file_dialog_state()
end,
--[[tooltip text]] nil,
local_modifications_color(filename))
x = x+w+10
end
local y = add_files_to_dialog(Directory_contents, Menu_left+10, Menu_bottom+10, local_modifications_color)
if Stash_directory_contents == nil then
-- on the first frame after dialog is enabled
Stash_directory_contents = directory_contents(Stash_directory)