Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 12-27-2020, 07:22 AM   #1
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Move file : invalide folder path

I wanted to move some files into a folder and since I'm under windows, I used the anti-slash '\' >> "Error, invalid path" >> replaced it by '/' >> OK

Ah, a little parse/replace is missing
un_pogaz is offline   Reply With Quote
Old 12-27-2020, 09:22 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
All epub paths are bookpaths from the epub root so these should only use "/" as all hrefs do on all platforms.

Checked the actual code and I am happy that it handles things and only lets valid bookpaths through and \ is not a valid url or href character so I think the code does what it needs to here:

Code:
SelectFolder select_folder(group, m_Book, this);

    // Get the destination folder from the user
    if (select_folder.exec() != QDialog::Accepted) {
        return;
    }

    QString folder_path = select_folder.GetFolder();
    // Make sure folder_path is valid if abort
    bool valid_path = folder_path.indexOf("..") == -1;
    valid_path = valid_path && folder_path.indexOf("\\") == -1;
    valid_path = valid_path && !folder_path.startsWith("/");
    valid_path = valid_path && !folder_path.startsWith("./");
    valid_path = valid_path && !folder_path.startsWith(".");
    valid_path = valid_path && folder_path.indexOf("/.") == -1;
    valid_path = valid_path && !folder_path.startsWith("META-INF");
    valid_path = valid_path && folder_path.indexOf("META-INF") == -1;
    
    if (!valid_path) {
        Utility::DisplayStdErrorDialog(
	    tr("Destination Folder has invalid path \"%1\"").arg(folder_path));
	return;  
    }
If your destination already existed you would see its bookpath in the SelectFolder dialog and can see what types of paths it wants. The BookBrowser is not a generic File browser and as such uses / as its folder separator.

Last edited by KevinH; 12-27-2020 at 10:56 AM.
KevinH is offline   Reply With Quote
Old 12-29-2020, 04:14 AM   #3
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Ok, this is an invalid character, but as is the folder separation character in Windows, applying a simple replace '\' to '/' before testing and moving, could be handy.
That's what I meant.

I know that Windows is inferior in this usage, but since it is a folder/file path, most programs (see languages) consider both characters as equivalent, probably thanks to a small and discreet character replacement.
This is not the case with Sigil, which is "too" strict.
un_pogaz is offline   Reply With Quote
Old 12-29-2020, 12:15 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
Yes, we could do that to help some users who are not distinguishing internal epub paths from external OS file paths.

But then I would worry that those same people may start using the wrong folder separator in hrefs and src attributes and epub root relative paths throughout css, opf, xhtml, ncx, etc. Also because BookBrowser is not meant to be a FileBrowser that change may confuse things even more.

So Sigil when dealing with paths internal to the epub tries to uniformly use the forward slash just like Qt and Python in this regard. At least that was the design idea.

Yes, it should be an easy change to make, I am just not sure it is for the best. But I am no Windows user, so perhaps others will weigh in on if this will serve to just confuse users or not.
KevinH is offline   Reply With Quote
Old 12-29-2020, 12:40 PM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by KevinH View Post
But I am no Windows user, so perhaps others will weigh in on if this will serve to just confuse users or not.
1. Windows supports slashes in command prompt/Explorer windows since at least Windows 7. For example, users can enter both:

Code:
cd c:/Windows
and

Code:
cd c:\Windows
2. Slashes are the default path separators in at least two of the supported operating systems.

3. Users should never have to manually enter paths, since Sigil will automatically suggest the right location(s), when users click the Folders drop-down button.
Doitsu is offline   Reply With Quote
Old 12-29-2020, 12:42 PM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I'm in favor of leaving it the way it is. The tooltip path shows the forward slash. Book Browser shows the forward slash (if the preference to show the full bookpath is turned on). And the Move dialog itself shows the forward slash whenever selecting existing folders to move resources to. Changing it just to let Windows users continue to make the same mistake over and over (with no notice) makes little sense to me. Make the mistake once, learn what's expected and move on. It's a non-issue in my opinion.
DiapDealer is offline   Reply With Quote
Old 12-29-2020, 12:49 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
4) Users seeking to alter the internal structure of an epub are unlikely to be tripped up by the forward slash url-path requirement.
DiapDealer is offline   Reply With Quote
Old 12-30-2020, 05:46 AM   #8
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Quote:
Originally Posted by DiapDealer View Post
I'm in favor of leaving it the way it is. The tooltip path shows the forward slash. Book Browser shows the forward slash (if the preference to show the full bookpath is turned on). And the Move dialog itself shows the forward slash whenever selecting existing folders to move resources to. Changing it just to let Windows users continue to make the same mistake over and over (with no notice) makes little sense to me. Make the mistake once, learn what's expected and move on. It's a non-issue in my opinion.
WHAT ??!!
Why is it a mistake to use the default folder separator of your operating system ???
I'm not talking about how it was saved or displayed, just the tolerance of Input Text.
Just the Input Text, what happens behind it, I don't care.

If making a simple "Replace character" (one, has a specific use and in a single window) for a little interpolarity is too complicated:
OK, I'm out.
Enjoy your world as a minority Linuxian.
un_pogaz is offline   Reply With Quote
Old 12-30-2020, 07:46 AM   #9
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by un_pogaz View Post
Enjoy your world as a minority Linuxian.
This has nothing to do with Linux. If you look at the epub specs, you'll see that users must use URLs for all path references. Therefore, it makes sense to expect users to follow this convention.
Doitsu is offline   Reply With Quote
Old 12-30-2020, 09:13 AM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Do browsers automatically fix urls for Windows users who use backslashes instead of forward ones? Does Sigil fix any other hrefs where a user mistakenly uses back slashes? The paths to files in epubs are hrefs, not os-specific paths.

Quote:
If making a simple "Replace character" (one, has a specific use and in a single window) for a little interpolarity is too complicated:
OK, I'm out.
Enjoy your world as a minority Linuxian.
Bye.

As to your ridiculous insinuation that I would ever limit myself to a single operating system: enjoy your naivete.
DiapDealer is offline   Reply With Quote
Old 12-30-2020, 02:26 PM   #11
jmurphy
Connoisseur
jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.
 
Posts: 88
Karma: 1133066
Join Date: Sep 2007
Device: ipaq
Quote:
Originally Posted by DiapDealer View Post
Do browsers automatically fix urls for Windows users who use backslashes instead of forward ones?
Nitpick: On Windows at least, both Chrome and (Chromium) Edge do exactly that.
jmurphy is offline   Reply With Quote
Old 12-30-2020, 04:08 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Well would you look at that?

I'm still not really in favor of Sigil doing it. But if someone were to submit a pull request that doesn't break anything else, I'm sure Kevin and I would at least consider incorporating it. I'm just not going to take time to code it up.
DiapDealer is offline   Reply With Quote
Old 12-30-2020, 10:29 PM   #13
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I often type "http:\\whatever/comes/next.com", current browsers (including firefox) etc don't seem to mind, but it does bother people if I type them like that in a message, email etc .

It makes me wonder if there was a time when URIs did use '\\' after the protocol name.

Why is the '//' there anyway, is the ':' not enough of a delimiter?

BR
BetterRed is offline   Reply With Quote
Old 01-02-2021, 01:54 AM   #14
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I'm pretty sure that back-slashes where never valid in URI's. But, the URI sort of looks like a file path and that's what Windows uses for the separator, so...

And apparently, the "//" indicates the start of the "authority component". Or at least it does according to the Wikipedia article: https://en.wikipedia.org/wiki/Unifor...rce_Identifier
davidfor is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set content-server [path to library folder...] on Win 10 sh1cpan Server 3 08-06-2020 05:09 PM
Sigil temporary files folder default path dlibke Sigil 13 06-06-2019 04:28 AM
updating folder/file path on device sbergstc Calibre Companion 3 09-06-2016 06:37 PM
I have a question about the end of folder path,help! Jerome0840 Library Management 11 03-23-2013 10:48 AM
Move ebooks to folder helsan Library Management 2 02-23-2013 08:34 PM


All times are GMT -4. The time now is 02:20 AM.


MobileRead.com is a privately owned, operated and funded community.