[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Qt 4.8 QUrl.toLocalFile behavior change,
From:       Kevin Kofler <kevin.kofler () chello ! at>
Date:       2011-10-30 18:02:48
Message-ID: j8k3gb$5su$1 () dough ! gmane ! org
[Download RAW message or body]

Kevin Kofler wrote:
> No, it doesn't.
> 
> There's actually a difference between KUrl(str):
> https://projects.kde.org/projects/kde/kdelibs/repository/entry/kdecore/io/kurl.cpp?rev=KDE%2F4.7#L400
> and KUrl::fromPathToUrl(str):
> https://projects.kde.org/projects/kde/kdelibs/repository/entry/kdecore/io/kurl.cpp?rev=KDE%2F4.7#L1669
> and it affects relative paths. KUrl(str) will treat a relative path as a
> URL, KUrl::fromPathToUrl(str) will treat it as a path! Both treat absolute
> paths as paths and URLs with scheme as URLs.

Oops, I misread the code!

They both do the same thing after all, fromPathToUrl explicitly does NOT
treat relative paths as paths.

But that doesn't change much of the rest of my message: we definitely do
need an API which treats relative paths as file paths (for most
applications) and an API which treats relative paths as relative URLs (for
web browsers and such).

I think there should be 3 ways to construct a URL:
1. from a path (always), i.e. the current KUrl::fromPath
2. heuristically (replacing the current KUrl::KUrl and KUrl::fromPathToUrl):
   * absolute paths should be file paths
   * relative paths should be file paths (!) (currently, they're URLs)
   * everything with a URL scheme (protocol) should be a URL
3. from a URL (always) – web browsers or any other app where the relative
   context is a URL context should use this instead of 2.

        Kevin Kofler

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic