Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an option to not create a SDR folder for each folder opened ? #4831

Closed
mooms06 opened this issue Mar 23, 2019 · 5 comments · Fixed by #10074
Closed

Is there an option to not create a SDR folder for each folder opened ? #4831

mooms06 opened this issue Mar 23, 2019 · 5 comments · Fixed by #10074

Comments

@mooms06
Copy link

mooms06 commented Mar 23, 2019

Hi !
I'm using KOReader on a PocketBook 740/InkPad 3.

I would rather like that KOReader will not create these folders, is it possible ?

Thank you.

@poire-z
Copy link
Contributor

poire-z commented Mar 23, 2019

These .sdr directories contain some metadata.epub.lua with the settings/position/highlights for opened books.
If you opened a few to just look at them and are not willing to read them soon, you can hold on the file and choose "Purge .sdr" to remove that dir and its content and have the book unread.

Some things in the code might depend on them. It's also supposed to help if you move books around, or switch removable storage.
Previously, the book settings were saved in koreader/history/.

It seems you could get back that original behaviour by commenting one line in the code:

--- a/frontend/docsettings.lua
+++ b/frontend/docsettings.lua
@@ -85,7 +85,7 @@ end

 function DocSettings:ensureSidecar(sidecar)
     if lfs.attributes(sidecar, "mode") ~= "directory" then
-        lfs.mkdir(sidecar)
+        -- lfs.mkdir(sidecar)
     end
 end

Dunno what may break.

@mooms06
Copy link
Author

mooms06 commented Mar 23, 2019

Ça fonctionne, merci à toi.
It works, thank you.

@poire-z
Copy link
Contributor

poire-z commented Oct 31, 2019

To have the above hack working on Android, create a /sdcard/koreader/patch.lua file with:

local orig_path = package.path
package.path = "frontend/?.lua;" .. package.path
local DocSettings = require("docsettings")
DocSettings.ensureSidecar = function() end
package.path = orig_path

Still some caveats: books won't be marked as opened in File browser.
So, more work would be needed if we'd wanted to have that as a real option.

@Iey4iej3
Copy link

I think that it is better to reopen this issue. These directory seem polluting the directory where PDFs are stored which does not seem to be satisfactory.

@Iey4iej3
Copy link

To have the above hack working on Android, create a /sdcard/koreader/patch.lua file with:

local orig_path = package.path
package.path = "frontend/?.lua;" .. package.path
local DocSettings = require("docsettings")
DocSettings.ensureSidecar = function() end
package.path = orig_path

Still some caveats: books won't be marked as opened in File browser. So, more work would be needed if we'd wanted to have that as a real option.

This patch does not seem to work. sdr directories are still produced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants