-
Notifications
You must be signed in to change notification settings - Fork 373
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
Touch parent folders when editing a file #2382
Comments
I'm not sure if I understand right, but it might be just how the filesystem used for that folder works.
Changing a file in a folder not always leads to a timestamp change in the parent director(ies). And Markor only reads out filesystem metadata.
This is a problem because from the main menu, it is not possible to tell which folder was edited last.
Correct, you may not put too much relevance in what timestamps directories have. But thats regardless of what software you use.
|
Yes possibly. But is not it possible that we initiate a manual touch operation on the folder? I can think of no reason why this could be dangerous or should not be done. For example if markor home folder is
True, I would agree with you about any other folder outside of the main markor directory. But the folders inside the markor directory are dedicated for markor and for storing notes. So in a sense they are local, and are used solely for organising notes, mainly by the markor app. |
Does any other editor or alike do that - touching all parent directories? I'm not aware of that at least and it may have unwanted side effects (i.e. with sync clients, permissions etc). |
You are right. I tested two browsers on linux dolphin and nautilus; both touch only the immediate parent folder, but not beyond. I think in the case of markor this would be sufficient. |
I don't check the code, but I assume there is no statement in the browsers to do explicitly touch a parent folder. Rather something how the OS or filesystem behaves in that specific case. The problem is also that there is not always <the one and only parent>. You can have countless of symlinks if the filesystem supports it and touching one won't affect the other. (not even with absolute filepaths you can be sure [bind mounts]) I understand why you are asking and want to have such a change, but humbly said preferable it's not added. The file handling is very complex and I don't want additional rules if they are not necessary. This is something the filesystem and OS should take care of and do their default handling in case of file writing. |
Alright. I figured it out: It seems like Android only touches the immediate parent folder if: 1. either a new file has been created inside, or 2. an existing file gets renamed. It does not touch the parent folder if an existing file is touched/edited. This applies not only to markor, but also to other Android file browsers. Regarding what you said, certainly, this is something that should be automatically handled by Android filesystem. But please note that:
Perhaps it is possible to make an extra system call to initiate parent folder touching? |
You could just write an external script to do this with termux |
I would like to program this feature, I would appreciate any help as I have little knowledge about Android: I would suggest putting a check in side the function which writes changes to a file, that checks: If the file exists in a folder within the Markor home folder, touch the immediate parent folder. Otherwise do nothing. Is this a sound strategy? And can anyone suggest which files I should edit? What remains is the system call to touch the folder, I have no idea if such a thing exists but I'll start researching it.. |
I think this should not be done. Touching the parent folder is when I file is edited is not standard filesystem behavior. Imo this should be left to the filesystem. There could well be side effects - sync apps breaking etc. |
I understand your fears. But please allow me to challenge you: Are there any side effects when a new file is created (the parent folder is automatically touched -by the filesystem-)? Are there any side effects when a file is renamed (the parent folder is automatically touched)? In the same way, there shouldn't be any danger if we trigger whatever system mechanism is being triggered in the two cases above. I think this is simply a design choice that Android designers made, perhaps it has its useful cases. But for us, a notes program, you want to see the notes/folders you last modified near the top. Consider this use case: I have a folder "Family", containing 10 notes, each one named afte a family member. I edit them often. After a couple of weeks this folder will be pushed down to the bottom of my notes (despite it being the most edited folder). And I will have to scroll down searching for it every time. If you are still unwilling to integrate such a behaviour, I will close this issue and ask it as a question in the discussion.. Thanks very much. |
The Ext4 fs on my laptop does not update the folder mod time when a child file is modified. Only when a child file is created / deleted. Fundamentally, this is @gsantner's decision to make, but IMO we should not touch parent folder(s) when a file is saved. |
I have solved it by editing the function
|
I have been using it now daily for more than a week without any issues. If this simple code is something you would merge, I would happily create a MR. |
Description
Information
Android version: 13
Device: Pixel a5
App Version: 2.12.5
Source
GitHub Releases
Format / File type
Not specific
Additional info / Log
The text was updated successfully, but these errors were encountered: