[Qgis-developer] [SoC] beta release of Home Range plugin for QGIS

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Aug 1 04:37:33 EDT 2008


2008/8/1 Tim Sutton <tim at linfiniti.com>:

>> (why, why windows doesn't use slashes as separators? portability is a _headache_!!)
>
> Since you have Qt4 at your fingertips look at QDir::separator() which
> will give the correct string for the OS separator. There is also a
> call on QDir::nativeSeparators(QString) which will convert a path to
> the platform native separator format. Both are static calls so you
> dont need an instance first.

 Or in python there's os.path.join:

Linux:
>>> import os
>>> os.path.join("foo","bar")
'foo/bar'

Windows:
>>> os.path.join("foo","bar")
'foo\\bar'

VAX/VMS:
>>> os.path.join("foo","bar")
'foo.bar'

 (I made that last one up, but VAX/VMS paths used to be of the form
device:[dir.dir] if I recall correctly!)

Various other functions under os.path are useful for filename and path
manipulation.

Barry


More information about the Qgis-developer mailing list