Topic: Filesystem Library and Standardized Paths


Author: =?UTF-8?Q?Jens_=C3=85kerblom?= <akerblom.jens@gmail.com>
Date: Sun, 11 Sep 2016 08:19:34 -0700 (PDT)
Raw View
------=_Part_48_1727590303.1473607174910
Content-Type: multipart/alternative;
 boundary="----=_Part_49_928330852.1473607174910"

------=_Part_49_928330852.1473607174910
Content-Type: text/plain; charset=UTF-8

Hello there,

I've been looking through the proposed C++17 Filesystem library and thought
it would be a nice add-on to have common paths. The only path I see that is
already present is the *std::filesystem::temp_directory_path*. The
directories of interest (as I see) would be

   - *executable_directory_path*, *installed_directory_path* or maybe a
   better name, *bundle_directory_path*, directory where the executable is
   being run / has been installed. Assumed to be read-only.
   - *userdata_directory_path*, directory where current user stores data,
   "My Documents" on Windows for example. Assume permission required to write
   and read.
   - *cache_directory_path*, directory to data that persists longer than in
   *temp_diretory_path*, can be removed by OS if deemed necessary.
   "Library/Cache" on iOS for example. Assume write and read permission.
   - *appdata_directory_path*, directory where the application can store
   persistent data not to be shared with other application.
   "/data/data/<package_name>" on Android for example. Assume write and read
   permissions.

I'm sure there are plenty of other common useful paths you can think of in
addition to the above.

Is there anything like this already proposed and / or rejected? If not, do
you think this would be a good extension to the Filesystem Library?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/316e66e9-764b-40da-bffc-e0ce2ed75ddd%40isocpp.org.

------=_Part_49_928330852.1473607174910
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello there,<br><br>I&#39;ve been looking through the prop=
osed C++17 Filesystem library and thought it would be a nice add-on to have=
 common paths. The only path I see that is already present is the <b>std::f=
ilesystem::temp_directory_path</b>. The directories of interest (as I see) =
would be<br><ul><li><b>executable_directory_path</b>, <b>installed_director=
y_path</b> or maybe a better name, <b>bundle_directory_path</b>, directory =
where the executable is being run / has been installed. Assumed to be read-=
only.<br></li><li><b>userdata_directory_path</b>, directory where current u=
ser stores data, &quot;My Documents&quot; on Windows for example. Assume pe=
rmission required to write and read.<br></li><li><b>cache_directory_path</b=
>, directory to data that persists longer than in <b>temp_diretory_path</b>=
, can be removed by OS if deemed necessary. &quot;Library/Cache&quot; on iO=
S for example. Assume write and read permission.<br></li><li><b>appdata_dir=
ectory_path</b>, directory where the application can store persistent data =
not to be shared with other application. &quot;/data/data/&lt;package_name&=
gt;&quot; on Android for example. Assume write and read permissions.<br></l=
i></ul>I&#39;m sure there are plenty of other common useful paths you can t=
hink of in addition to the above.<br><br>Is there anything like this alread=
y proposed and / or rejected? If not, do you think this would be a good ext=
ension to the Filesystem Library?<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/316e66e9-764b-40da-bffc-e0ce2ed75ddd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/316e66e9-764b-40da-bffc-e0ce2ed75ddd=
%40isocpp.org</a>.<br />

------=_Part_49_928330852.1473607174910--

------=_Part_48_1727590303.1473607174910--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 11 Sep 2016 08:32:18 -0700 (PDT)
Raw View
------=_Part_201_1271806046.1473607938485
Content-Type: multipart/alternative;
 boundary="----=_Part_202_2067860669.1473607938485"

------=_Part_202_2067860669.1473607938485
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Sunday, September 11, 2016 at 11:19:35 AM UTC-4, Jens =C3=85kerblom wrot=
e:
>
> Hello there,
>
> I've been looking through the proposed C++17 Filesystem library and=20
> thought it would be a nice add-on to have common paths. The only path I s=
ee=20
> that is already present is the *std::filesystem::temp_directory_path*.=20
> The directories of interest (as I see) would be
>
>    - *executable_directory_path*, *installed_directory_path* or maybe a=
=20
>    better name, *bundle_directory_path*, directory where the executable=
=20
>    is being run / has been installed. Assumed to be read-only.
>   =20
> This should not just be a directory path; it should include the name of=
=20
the executable as well. If you want the directory, just clip off the=20
executable. While `argv[0]` works on some platforms, it doesn't work on=20
UTF-16 platforms. This would give us a standard way to get at the=20
executable file path.

>
>    -=20
>    - *userdata_directory_path*, directory where current user stores data,=
=20
>    "My Documents" on Windows for example. Assume permission required to w=
rite=20
>    and read.
>    - *cache_directory_path*, directory to data that persists longer than=
=20
>    in *temp_diretory_path*, can be removed by OS if deemed necessary.=20
>    "Library/Cache" on iOS for example. Assume write and read permission.
>    - *appdata_directory_path*, directory where the application can store=
=20
>    persistent data not to be shared with other application.=20
>    "/data/data/<package_name>" on Android for example. Assume write and r=
ead=20
>    permissions.
>   =20
> I don't like `temp_directory_path` as is, so I don't want to see a=20
proliferation of similar platform-specific directories.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/aeffe555-c173-4a85-bbc8-b72ff6c3a333%40isocpp.or=
g.

------=_Part_202_2067860669.1473607938485
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Sunday, September 11, 2016 at 11:19:35 AM UTC-4, Jens =
=C3=85kerblom wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Hello there,<br><br>I&#39;ve been looking through the proposed C++=
17 Filesystem library and thought it would be a nice add-on to have common =
paths. The only path I see that is already present is the <b>std::filesyste=
m::temp_<wbr>directory_path</b>. The directories of interest (as I see) wou=
ld be<br><ul><li><b>executable_directory_path</b>, <b>installed_directory_p=
ath</b> or maybe a better name, <b>bundle_directory_path</b>, directory whe=
re the executable is being run / has been installed. Assumed to be read-onl=
y.<br></li></ul></div></blockquote><div>This should not just be a directory=
 path; it should include the name of the executable as well. If you want th=
e directory, just clip off the executable. While `argv[0]` works on some pl=
atforms, it doesn&#39;t work on UTF-16 platforms. This would give us a stan=
dard way to get at the executable file path.<br></div><blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;"><div dir=3D"ltr"><ul><li><br></li><li><b>userdata_d=
irectory_path</b>, directory where current user stores data, &quot;My Docum=
ents&quot; on Windows for example. Assume permission required to write and =
read.</li><li><b>cache_directory_path</b>, directory to data that persists =
longer than in <b>temp_diretory_path</b>, can be removed by OS if deemed ne=
cessary. &quot;Library/Cache&quot; on iOS for example. Assume write and rea=
d permission.<br></li><li><b>appdata_directory_path</b>, directory where th=
e application can store persistent data not to be shared with other applica=
tion. &quot;/data/data/&lt;package_name&gt;&quot; on Android for example. A=
ssume write and read permissions.<br></li></ul></div></blockquote><div>I do=
n&#39;t like `temp_directory_path` as is, so I don&#39;t want to see a prol=
iferation of similar platform-specific directories.</div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/aeffe555-c173-4a85-bbc8-b72ff6c3a333%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/aeffe555-c173-4a85-bbc8-b72ff6c3a333=
%40isocpp.org</a>.<br />

------=_Part_202_2067860669.1473607938485--

------=_Part_201_1271806046.1473607938485--

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 16 Sep 2016 11:14:36 -0400
Raw View
On 2016-09-11 11:19, Jens =C3=85kerblom wrote:
> Hello there,
>=20
> I've been looking through the proposed C++17 Filesystem library and thoug=
ht=20
> it would be a nice add-on to have common paths. The only path I see that =
is=20
> already present is the *std::filesystem::temp_directory_path*. The=20
> directories of interest (as I see) would be
>=20
>    - *executable_directory_path*, *installed_directory_path* or maybe a=
=20
>    better name, *bundle_directory_path*, directory where the executable i=
s=20
>    being run / has been installed. Assumed to be read-only.

I don't think you can implement this without platform support. That
support *might* already be available on common platforms, but then again
it might not.

Implementing it for example on Linux requires digging around in /proc.
Specifically, you need something like https://github.com/gpakosz/whereami.

>    - *userdata_directory_path*, directory where current user stores data,=
=20
>    "My Documents" on Windows for example. Assume permission required to w=
rite=20
>    and read.
>    - *cache_directory_path*, directory to data that persists longer than =
in=20
>    *temp_diretory_path*, can be removed by OS if deemed necessary.=20
>    "Library/Cache" on iOS for example. Assume write and read permission.
>    - *appdata_directory_path*, directory where the application can store=
=20
>    persistent data not to be shared with other application.=20
>    "/data/data/<package_name>" on Android for example. Assume write and r=
ead=20
>    permissions.

These may be simplifications. I would compare with existing prior art,
e.g. http://doc.qt.io/qt-5/qstandardpaths.html.

--=20
Matthew

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/nrh28q%24mir%241%40blaine.gmane.org.

.


Author: =?UTF-8?Q?Jens_=C3=85kerblom?= <akerblom.jens@gmail.com>
Date: Tue, 20 Sep 2016 01:25:33 -0700 (PDT)
Raw View
------=_Part_4536_1518325317.1474359933184
Content-Type: multipart/alternative;
 boundary="----=_Part_4537_2143730215.1474359933185"

------=_Part_4537_2143730215.1474359933185
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


>
> These may be simplifications. I would compare with existing prior art,=20
> e.g. http://doc.qt.io/qt-5/qstandardpaths.html.=20
>

Thank you for the QStandardPaths link, did not know that existed. This is=
=20
exactly what I'm hoping would end up in the standard (or at least some of=
=20
the paths). As I see it, any file operations in C++ must either use=20
current_path() or do their own platform dependent path lookup (or use third=
=20
party libraries to do it for them). Shifting the responsibility to write=20
these path lookups to the standard library writers would thus make it=20
easier to write platform independent code in my opinion.

Do you think this is worth taking forward by writing a proper proposal?

On Saturday, September 17, 2016 at 6:12:10 PM UTC+3, Matthew Woehlke wrote:
>
> On 2016-09-11 11:19, Jens =C3=85kerblom wrote:=20
> > Hello there,=20
> >=20
> > I've been looking through the proposed C++17 Filesystem library and=20
> thought=20
> > it would be a nice add-on to have common paths. The only path I see tha=
t=20
> is=20
> > already present is the *std::filesystem::temp_directory_path*. The=20
> > directories of interest (as I see) would be=20
> >=20
> >    - *executable_directory_path*, *installed_directory_path* or maybe a=
=20
> >    better name, *bundle_directory_path*, directory where the executable=
=20
> is=20
> >    being run / has been installed. Assumed to be read-only.=20
>
> I don't think you can implement this without platform support. That=20
> support *might* already be available on common platforms, but then again=
=20
> it might not.=20
>
> Implementing it for example on Linux requires digging around in /proc.=20
> Specifically, you need something like https://github.com/gpakosz/whereami=
..=20
>
>
> >    - *userdata_directory_path*, directory where current user stores=20
> data,=20
> >    "My Documents" on Windows for example. Assume permission required to=
=20
> write=20
> >    and read.=20
> >    - *cache_directory_path*, directory to data that persists longer tha=
n=20
> in=20
> >    *temp_diretory_path*, can be removed by OS if deemed necessary.=20
> >    "Library/Cache" on iOS for example. Assume write and read permission=
..=20
> >    - *appdata_directory_path*, directory where the application can stor=
e=20
> >    persistent data not to be shared with other application.=20
> >    "/data/data/<package_name>" on Android for example. Assume write and=
=20
> read=20
> >    permissions.=20
>
> These may be simplifications. I would compare with existing prior art,=20
> e.g. http://doc.qt.io/qt-5/qstandardpaths.html.=20
>
> --=20
> Matthew=20
>
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/2d8cf6fa-76f0-4147-bada-771f836bc435%40isocpp.or=
g.

------=_Part_4537_2143730215.1474359933185
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">=
These may be simplifications. I would compare with existing prior art,
<br>e.g. <a href=3D"http://doc.qt.io/qt-5/qstandardpaths.html" target=3D"_b=
lank" rel=3D"nofollow">http://doc.qt.io/qt-5/<wbr>qstandardpaths.html</a>.
<br></blockquote><br>Thank you for the QStandardPaths link, did not know th=
at existed. This is exactly what I&#39;m hoping would end up in the standar=
d (or at least some of the paths). As I see it, any file operations in C++ =
must either use current_path() or do their own platform dependent path look=
up (or use third party libraries to do it for them). Shifting the responsib=
ility to write these path lookups to the standard library writers would thu=
s make it easier to write platform independent code in my opinion.<br><br>D=
o you think this is worth taking forward by writing a proper proposal?<br><=
br>On Saturday, September 17, 2016 at 6:12:10 PM UTC+3, Matthew Woehlke wro=
te:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;">On 2016-09-11 11:19, Jens =
=C3=85kerblom wrote:
<br>&gt; Hello there,
<br>&gt;=20
<br>&gt; I&#39;ve been looking through the proposed C++17 Filesystem librar=
y and thought=20
<br>&gt; it would be a nice add-on to have common paths. The only path I se=
e that is=20
<br>&gt; already present is the *std::filesystem::temp_<wbr>directory_path*=
.. The=20
<br>&gt; directories of interest (as I see) would be
<br>&gt;=20
<br>&gt; =C2=A0 =C2=A0- *executable_directory_path*, *installed_directory_p=
ath* or maybe a=20
<br>&gt; =C2=A0 =C2=A0better name, *bundle_directory_path*, directory where=
 the executable is=20
<br>&gt; =C2=A0 =C2=A0being run / has been installed. Assumed to be read-on=
ly.
<br>
<br>I don&#39;t think you can implement this without platform support. That
<br>support *might* already be available on common platforms, but then agai=
n
<br>it might not.
<br>
<br>Implementing it for example on Linux requires digging around in /proc.
<br>Specifically, you need something like <a href=3D"https://github.com/gpa=
kosz/whereami" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fgpakosz%=
2Fwhereami\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGICiAAARywF8gktr6CKDFr2g=
saAw&#39;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/=
url?q\x3dhttps%3A%2F%2Fgithub.com%2Fgpakosz%2Fwhereami\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNGICiAAARywF8gktr6CKDFr2gsaAw&#39;;return true;">https:/=
/github.com/gpakosz/<wbr>whereami</a>.
<br>
<br>&gt; =C2=A0 =C2=A0- *userdata_directory_path*, directory where current =
user stores data,=20
<br>&gt; =C2=A0 =C2=A0&quot;My Documents&quot; on Windows for example. Assu=
me permission required to write=20
<br>&gt; =C2=A0 =C2=A0and read.
<br>&gt; =C2=A0 =C2=A0- *cache_directory_path*, directory to data that pers=
ists longer than in=20
<br>&gt; =C2=A0 =C2=A0*temp_diretory_path*, can be removed by OS if deemed =
necessary.=20
<br>&gt; =C2=A0 =C2=A0&quot;Library/Cache&quot; on iOS for example. Assume =
write and read permission.
<br>&gt; =C2=A0 =C2=A0- *appdata_directory_path*, directory where the appli=
cation can store=20
<br>&gt; =C2=A0 =C2=A0persistent data not to be shared with other applicati=
on.=20
<br>&gt; =C2=A0 =C2=A0&quot;/data/data/&lt;package_name&gt;&quot; on Androi=
d for example. Assume write and read=20
<br>&gt; =C2=A0 =C2=A0permissions.
<br>
<br>These may be simplifications. I would compare with existing prior art,
<br>e.g. <a href=3D"http://doc.qt.io/qt-5/qstandardpaths.html" target=3D"_b=
lank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.co=
m/url?q\x3dhttp%3A%2F%2Fdoc.qt.io%2Fqt-5%2Fqstandardpaths.html\x26sa\x3dD\x=
26sntz\x3d1\x26usg\x3dAFQjCNFy3SI69fCG6NqmmErbL0NXcYoggQ&#39;;return true;"=
 onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdo=
c.qt.io%2Fqt-5%2Fqstandardpaths.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNFy3SI69fCG6NqmmErbL0NXcYoggQ&#39;;return true;">http://doc.qt.io/qt-5/<wb=
r>qstandardpaths.html</a>.
<br>
<br>--=20
<br>Matthew
<br>
<br></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2d8cf6fa-76f0-4147-bada-771f836bc435%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2d8cf6fa-76f0-4147-bada-771f836bc435=
%40isocpp.org</a>.<br />

------=_Part_4537_2143730215.1474359933185--

------=_Part_4536_1518325317.1474359933184--

.


Author: Bo Persson <bop@gmb.dk>
Date: Tue, 20 Sep 2016 17:50:05 +0200
Raw View
On 2016-09-20 10:25, Jens =C3=85kerblom wrote:
>     These may be simplifications. I would compare with existing prior art=
,
>     e.g. http://doc.qt.io/qt-5/qstandardpaths.html
>     <http://doc.qt.io/qt-5/qstandardpaths.html>.
>
>
> Thank you for the QStandardPaths link, did not know that existed. This
> is exactly what I'm hoping would end up in the standard (or at least
> some of the paths). As I see it, any file operations in C++ must either
> use current_path() or do their own platform dependent path lookup (or
> use third party libraries to do it for them). Shifting the
> responsibility to write these path lookups to the standard library
> writers would thus make it easier to write platform independent code in
> my opinion.

The portability of programs using items like DesktopLocation will still=20
be limited to systems actually having a desktop. And using paths.


>
> Do you think this is worth taking forward by writing a proper proposal?

Possibly.

But it is not a total advantage to have too many features=20
"conditionally-supported with implementation-defined behavior". Because=20
the perceived increased portabilty can become a new problem if only one=20
or two systems actually support all the features.


     Bo Persson


--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/nrrlre%248id%241%40blaine.gmane.org.

.