Before:
Now:
Unchanged: once you set the notes directory it gets remembered for future runs.
Now the Readme is a lot simpler.
I tried to make migrating simpler, but this is complicated enough (see Manual_tests.md)
RVVRBJFNEHF3WRQARNVTXM75PLL4UKJZISPWPK45D6TVY45VVOTAC 5LKWSVI6U5CCZBDFBU2I3O5VOCK42UNVQXEVO5RT2JYOQQL44HWAC JML3NG2GN4MSJQMLHTAT2UPP4IVI3K3CT6UPJ6L3JDLVF5FZTYXAC JVS7DDA3I6U4KDZWVXNZKNLHPVTC7BXW6XU3F6DOVCMYWWDSNCAAC MN7IONOTMGWYZUFBYK3VJLYT4ZQ37ZFEAFO7IJ3AB6NXPKDY7PMAC 7XHWKCCOIFTF2PP474A4QYFYB3BV52OXOCHFW3IJ7XL5K3LJT5CAC 3GIZSN7R6TDB6KD5H3CASDDCEPDJAQ733GNYSPZBJCF7RQQWU3ZQC ZMVYETQRAHLO4YLBK5EPJRZ4GUZTPLHVGDCIZSRVYT25V25KB4WQC R3GR4I6O26PQF7F432CVDP4A4GA5542O3RWYHUTJSX6JMHFT3X5QC NUD7IIPNBTI2VXS643AEZ4MOS5USTHQWKGUKD5CYCK5ZTJN4FP5QC E3E3ICCK4FPJCEMRNRWJ7WZYZ6SBGDRVYWNXG5CFBBDF2XZTZH2QC ZZOKGOFBNESTYQPZW6ODBMC2C75UL4DYMSKVTUMOWVZW4UMNO4FAC JMUE7GSN6QDQZ6NDRB55MRJMKJN6LBD6MVQPKROYPDOIXM7I3XNQC KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC UAX3KJOIN3XBSLKP4IAWAWSCI3DLDKF22A6HRMGA4FHY3AS2QRVAC I5AZCCITRO63LNWJRME5S4VV4BSSRBHCN7S2WBRZUPMLLPMYVHAAC M725FAFL7GBGMKYRFR7BB62PMNFKDIJKJPPT2MIGP76WVS6CS3MAC 74C6RCXRROHRH6AYCDWZF4EBNLI6OZGUXZKPOF6RFK222GHBHNDQC 53LXFA2O4DZ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ZZJMJ3S3QC 4X37LWXMH24S6LICL3MZKUKOTWHMS3SYOSVL2KEYEUCYLANYRPFAC J32JEWUVJO4QPIOXUQ2LI7PYYCTRSKW7247Y2IQZWU3ZB2UJZIZQC CAVPW3NGOW5IENWZ56A6EZF2FPDE3OP4CORT4RN6SNLMFTBLYZMQC ZAONCLY6WLSTD2H5KY73V532GRKSEV2XPOGTKHR6EAQDAVXYISMAC 2LZV4KUM5L44MKTGJA7IPSJPXRPDYCKHM63OHJIGIJNNA7UC2FMQC BJ5X5O4ACBBJ56LRBBSTCW6IBQP4HAEOOOPNH3SKTA4F66YTOIDAC Directory = 'data/'
Directory = nilDirectory_error = nil -- Any error encountered while determining Directory. If this is ever set, the app will do nothing but display it. (We can't rely on 'error' for that because we don't want to open up the sources in that situation.)
endif #arg > 0 thenDirectory = arg[1]print('setting Directory from commandline: '..arg[1])if Directory:sub(#Directory,#Directory) ~= '/' thenDirectory = Directory..'/'endprint('Directory is now '..Directory)endif Directory == nil thenprint('setting Directory_error')if Settings == nil thenDirectory_error ="Please run pensieve.love once from a terminal window and specify the\n".."location of your notes. The location will be remembered in future.\n".."Thank you! If all goes well, you won't see this message ever again."elseDirectory_error ="Please perform a one-time migration for your notes:\n".."\n".."* (optional) Move any existing notes in "..App.save_dir.."data\n".." or similar locations to your preferred location.\n".."\n".."* (optional) Move any existing "..App.save_dir.."config\n".." file _inside_ your notes directory to preserve any prior state\n".." of your note-taking surface (open columns, etc.).\n".."\n".."* Please run pensieve.love once from a terminal window and specify the\n".." location of your notes as an absolute path. This location will be\n".." remembered in future.\n".."\n".."Thank you! If all goes well, you won't see this message ever again."endreturn
Display_settings.column_width = Settings.column_widthfor _,column_name in ipairs(Settings.columns) docreate_column(column_name)
endfunction run.load_more_settings_from_notes_directory()local f = App.open_for_reading(Directory..'config')if f thenlocal directory_settings = json.decode(f:read())f:close()Display_settings.column_width = directory_settings.column_widthfor _,column_name in ipairs(directory_settings.columns) docreate_column(column_name)endCursor_pane.col = directory_settings.cursor_colCursor_pane.row = directory_settings.cursor_rowDisplay_settings.x = directory_settings.surface_xDisplay_settings.y = directory_settings.surface_yelse-- initialize surface with a single columncommand.recently_modified()
if Settings == nil then Settings = {} endSettings.x, Settings.y, Settings.displayindex = App.screen.position()
assert(Directory_error == nil) -- this will go into an infinite loop if handle_error ever tries to save settings-- side effect: save notes-related settings inside Directory
local f = App.open_for_writing(Directory..'config')assert(f)f:write(json.encode({columns=column_names,column_width=Display_settings.column_width,cursor_col=Cursor_pane.col,cursor_row=Cursor_pane.row,surface_x=Display_settings.x,surface_y=Display_settings.y,}))if Settings == nil then Settings = {} endSettings.x, Settings.y, Settings.displayindex = App.screen.position()
local success, errmsg = love.filesystem.append(outfilename, 'interrupted at '..Display_settings.search_all_progress_indicator..'\n')
local success, errmsg = append_to_file(outfilename, 'interrupted at '..Display_settings.search_all_progress_indicator..'\n')
This will read the notes from the `data.sample/` directory in this repo togive you a flavor for what the app is like.
From here on out, restarting pensieve.love will open the same directory.Run again from a terminal if you ever want to switch to a new directory.
While the sample gives you stuff to browse, don't use it to write any realnotes. LÖVE limits what directories apps can list files from (which is greatfor privacy), but has some confusing rules around them. Each app can onlywrite to files under a single directory, the app's _save directory_([love.filesystem.getSaveDirectory()](https://love2d.org/wiki/love.filesystem.getSaveDirectory)).In addition, reads will also fall back to read from the repo directory,enabling the sample experience. However, edits you make will not modify the`data.sample/` directory in this repo. Your notes will fragment between twodirectories, which can get confusing.To create your own directory of notes, run without an argument:```love .```pensieve.love will then create a `data/` directory in the app's save directoryas above. Confusing location, but everything will be in one place.
- start out with a non-default data set; default config file and data directory don't get clobbered- start out with a non-default data set and switch to editor and press ctrl+k to clear logs; default config file and data directory don't get clobbered
Load directory:- clear save dir, run, you get an error message telling you to specify a directory for notes- quit works- create an empty config file, run, you get an error message telling you to migrate your existing notes directory- quit works- clear save dir, run with a dir argument that doesn't exist; app creates dir and opens up with no data- quit works- on quit, app creates 'config' file within the dir- clear save dir, run with a dir argument that exists and contains no 'config'; app opens up- quit works- on quit, app creates 'config' file within the dir- run with a dir argument of '/' (that you don't have access to)?? app should either throw an error or save data you put in _somewhere_- run app from terminal with a dir argument; the app uses settings from 'config' inside that directory- quit works- run app from terminal with a dir argument, hit C-w; the app switches to source editor- app has a config with a `data_directory` key, run app from terminal with a dir argument; app opens up with new data directory- on quit, app saves the new data directory to the `data_directory` key