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

dotFiles "*_files" and "*.assets" from browser->save page to html #1704

Conversation

tifish
Copy link
Contributor

@tifish tifish commented May 16, 2022

Directories like "_files" and ".assets", are containers for pictures and other binary attachments. They should be hidden in file browser.

@gsantner
Copy link
Owner

gsantner commented May 16, 2022

I'm sorry to say, but I diasgree. Why would you lets say, hide picture attachments? Both from yourself, and from users?

If you really wanna hide ... the file browser already supports the most obvious and (unix) universal thing...dotfiles. So for assets that works already.

@tifish
Copy link
Contributor Author

tifish commented May 17, 2022

This is a directory in my file browser. There are so many *_files sub-directories, so I must scroll several pages to find the real notes. Moreover the directories and notes have similar names, it's really painful to find the edge between them. Would you give me some advice?

Screenshot_20220517-112853

@gsantner
Copy link
Owner

gsantner commented May 18, 2022

This is a directory in my file browser. There are so many *_files sub-directories, so I must scroll several pages to find the real notes. Moreover the directories and notes have similar names, it's really painful to find the edge between them. Would you give me some advice?

The question beforehand is, why do you even have those folders? I mean make a assets folder or whatever and have your files in that. And your documents in another folder?
Your files, your structure, your decisions.

so I must scroll several pages to find the real notes.

There is also reverse sort.

Also a possibility is a draggable scrollbar, like at editor.

@gsantner
Copy link
Owner

gsantner commented May 18, 2022

You did already quite some things in the project and I think everything is merged. I'm really not that guy who says no to everything. But I'm not really happy with adding this. For most users it's just bloat, and for us developers one more thing to watch out for.

@tifish
Copy link
Contributor Author

tifish commented May 19, 2022

The question beforehand is, why do you even have those folders? I mean make a assets folder or whatever and have your files in that. And your documents in another folder?

This folder is generated by Google Chrome when saving a web page. The *.assets folder is generated by Typora, a popular markdown editor.

There is also reverse sort.
Also a possibility is a draggable scrollbar, like at editor.

These are good features. I jsut want to save my time when maintaining my notes.

@tifish
Copy link
Contributor Author

tifish commented May 19, 2022

You did already quite some things in the project and I think everything is merged. I'm really not that guy who says no to everything. But I'm not really happy with adding this. For most users it's just bloat, and for us developers one more thing to watch out for.

I can't say most users need this. It's just my pain in everyday usage. So it's OK to reject the pull request. I respect this project and thank a lot to you.

@gsantner
Copy link
Owner

gsantner commented May 21, 2022

Can you send me a complete file list of that directory (adb shell ls -al /sdcard/...folder/)? You can optionally also anonymize the names, just keep the filename <-> foldername relation.

I want also to know, is it ALWAYS the case that when you have _files, you have also the .assets one albeit maybe empty? Or is either optional?

@gsantner gsantner changed the title New option to hide directories matching wildcards, e.g. "*_files" and "*.assets". WIP: New option to hide directories matching wildcards, e.g. "*_files" and "*.assets". May 21, 2022
@gsantner gsantner marked this pull request as draft May 21, 2022 10:19
@tifish
Copy link
Contributor Author

tifish commented May 24, 2022

Can you send me a complete file list of that directory (adb shell ls -al /sdcard/...folder/)? You can optionally also anonymize the names, just keep the filename <-> foldername relation.

The list here:

-rw-rw---- 1 root everybody 36878 2018-10-22 20:17 InnerFidelity's -Wall of Fame- Earphones.html
drwxrwx--- 2 root everybody  4096 2022-02-06 07:12 InnerFidelity's -Wall of Fame- Earphones_files
-rw-rw---- 1 root everybody 19769 2018-10-22 20:18 InnerFidelity's -Wall of Fame- Headphone Amplifiers.html
drwxrwx--- 2 root everybody  4096 2022-02-06 03:47 InnerFidelity's -Wall of Fame- Headphone Amplifiers_files
-rw-rw---- 1 root everybody 21303 2018-10-22 20:17 InnerFidelity's -Wall of Fame- Noise Canceling.html
drwxrwx--- 2 root everybody  4096 2022-02-07 01:50 InnerFidelity's -Wall of Fame- Noise Canceling_files
-rw-rw---- 1 root everybody 10008 2018-10-22 20:15 InnerFidelity's -Wall of Fame- On-Ear Open.html
drwxrwx--- 2 root everybody  4096 2022-02-06 09:36 InnerFidelity's -Wall of Fame- On-Ear Open_files
-rw-rw---- 1 root everybody 33053 2018-10-22 20:16 InnerFidelity's -Wall of Fame- On-Ear Sealed.html
drwxrwx--- 2 root everybody  4096 2022-02-07 01:55 InnerFidelity's -Wall of Fame- On-Ear Sealed_files
-rw-rw---- 1 root everybody 48964 2018-10-22 20:08 InnerFidelity's -Wall of Fame- Over-Ear Open.html
drwxrwx--- 2 root everybody  4096 2022-02-07 01:44 InnerFidelity's -Wall of Fame- Over-Ear Open_files
-rw-rw---- 1 root everybody 48031 2018-10-22 20:12 InnerFidelity's -Wall of Fame- Over-Ear Sealed.html
drwxrwx--- 2 root everybody  4096 2022-02-07 01:07 InnerFidelity's -Wall of Fame- Over-Ear Sealed_files
-rw-rw---- 1 root everybody 12549 2018-10-22 20:18 InnerFidelity's -Wall of Fame- Portable Music Players.html
drwxrwx--- 2 root everybody  4096 2022-02-07 00:36 InnerFidelity's -Wall of Fame- Portable Music Players_files
-rw-rw---- 1 root everybody 17627 2018-10-22 20:18 InnerFidelity's -Wall of Fame- Portable and Table-Top Speakers.html
drwxrwx--- 2 root everybody  4096 2022-02-07 00:24 InnerFidelity's -Wall of Fame- Portable and Table-Top Speakers_files
-rw-rw---- 1 root everybody 28198 2018-10-22 20:17 InnerFidelity's -Wall of Fame- Wireless.html
drwxrwx--- 2 root everybody  4096 2022-02-07 01:08 InnerFidelity's -Wall of Fame- Wireless_files

@tifish
Copy link
Contributor Author

tifish commented May 24, 2022

I want also to know, is it ALWAYS the case that when you have _files, you have also the .assets one albeit maybe empty? Or is either optional?

*_files and *.assets have no relations.

When I save a complete web page in Chrome, it generate a xxx.html file, and a xxx_files folder. There are images, scripts, css files in the xxx_files. If the web page contains no external resources, which is rare, the xxx_files folder won't be created. Or if I save with type "HTML Only" or "Single File", no xxx_files either.

*.assets folder is generated in Typora markdown editor. When I drag and drop a image into Typora, editing a document xxx.md, it automatically creates a xxx.assets folder, and place the image in the xxx.assets. So the xxx.assets is optional, but not empty.

@gsantner
Copy link
Owner

gsantner commented May 25, 2022

When you can make it nicely in around ~10 lines to check if the current folder is such a ""chrome bloated folder"" (containing assets/files/.html in that matching case) - you can add the logic to be hidden by .dotFiles logic.
So this means, no new setting and you get that stuff hidden builtin by dotFiles check state.

@tifish
Copy link
Contributor Author

tifish commented May 28, 2022

This can be a good solusion for _files folders, since they has existing for over 20 years. But .assets folders are introduced by Typora not so long ago, and the name can be chagned in the preferences. So this may be enough to solve my problems, but I'm not sure it's suitable for someone else.

@gsantner
Copy link
Owner

gsantner commented May 28, 2022

As said, detect the combination of html/asset/files folder and then only enable the hidden there. Not generally .asset(s)

--> if (filename.endwith("_files") && File::exists(filename.sub("_files$", ".html")) {
enable dotfiles hidden logic for this folder
}

@tifish
Copy link
Contributor Author

tifish commented May 31, 2022

I've done as you said.

@@ -601,7 +601,9 @@ private boolean canWrite(File file) {
public boolean accept(File dir, String filename) {
final File f = new File(dir, filename);
final boolean filterYes = f.isDirectory() || _dopt.fileOverallFilter == null || _dopt.fileOverallFilter.apply(f);
final boolean dotYes = _dopt.showDotFiles || !filename.startsWith(".");
final boolean dotYes = _dopt.showDotFiles || !filename.startsWith(".") &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add another (brace around the new conditions. otherwise - it's working/OK for you this way?

If so, this is ready for merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally I add a function to make it more clear. How do you think?

Copy link
Owner

@gsantner gsantner Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@gsantner gsantner changed the title WIP: New option to hide directories matching wildcards, e.g. "*_files" and "*.assets". New option to hide directories matching wildcards, e.g. "*_files" and "*.assets". Jun 5, 2022
@gsantner gsantner changed the title New option to hide directories matching wildcards, e.g. "*_files" and "*.assets". dotFiles typora "*_files" and "*.assets" Jun 5, 2022
@gsantner gsantner changed the title dotFiles typora "*_files" and "*.assets" dotFiles "*_files" and "*.assets" from browser->save page to html Jun 5, 2022
@gsantner gsantner marked this pull request as ready for review June 5, 2022 12:40
@gsantner gsantner merged commit 1bacac8 into gsantner:master Jun 5, 2022
@gsantner gsantner mentioned this pull request Jul 16, 2022
@gsantner gsantner added this to the Markor v2.10 milestone Jul 16, 2022
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 this pull request may close these issues.

2 participants