Find out whether a file is a remote file or not

Albert Astals Cid aacid at kde.org
Sun May 1 21:46:03 UTC 2016


El diumenge, 1 de maig de 2016, a les 19:12:11 CEST, Dominik Haumann va 
escriure:
> On Sun, May 1, 2016 at 6:28 PM, Dominik Haumann <dhaumann at kde.org> wrote:
> > Hi all,
> > 
> > do we have a mechanism in KDE to find out whether a file is a truly
> > local file, or a remote file?
> > 
> > With remote file I mean e.g. a sshfs mounted location that appears in
> > the file system, which integrates seamlessly into the local
> > filesystem, but in truth, it is not a local file.
> > 
> > As initial start, I'd consider local disks and plugged in USB sticks
> > local, everything else remote.
> > 
> > In Kate, we typically backup local files, and maybe "worse", by
> > default create swap files for local files. But given that remotely
> > mounted filesystem also appear as local files, this leads to a
> > potential bottleneck.
> > 
> > BUG: https://bugs.kde.org/show_bug.cgi?id=362288
> > 
> > CC: Vishesh, since maybe baloo also had to solve these issues
> 
> What I have found:
> 
> KIO contains [1] KMountPoint::probablySlow(), and it's returning true
> for nfs, cifs, and some others, but not for e.g. sshfs, see [2]. So
> this is not exactly what I want, or at least, it would need extension.
> 
> PS: The implementation of [2] could be much faster, given it first
> computes all bools, and only then checks them.
> 
> Anyways, using this, it would look similar to this:
> 
> KMountPoint::List mountedDeviceList = KMountPoint::currentMountPoints();
> KMountPoint::Ptr mountPoint =
> mountedDeviceList->findByDevice(kateDocument()->url());
> if (mountPoint && mountPoint->isProbablySlow()) {
>     // disalbe swap file and backups
> }
> 
> Is that the suggested solution, or is there a better way?

See https://marc.info/?l=kde-core-devel&m=138530914325647&w=2 for a similar 
question i made years ago, the answer was "we can probably do much better", 
but then noone stepped up to do that "much better" solution.

Cheers,
  Albert

> 
> Cheers,
> Dominik
> 
> [1]
> http://api.kde.org/frameworks-api/apidox-frameworks/frameworks5-apidocs/kio
> /html/classKMountPoint.html#a338731f8ed1c8b02b317da32857aa198 [2]
> http://api.kde.org/frameworks-api/apidox-frameworks/frameworks5-apidocs/kio
> /html/kmountpoint_8cpp_source.html#l00535
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel




More information about the Kde-frameworks-devel mailing list