Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #67678 > unrolled thread

How to get standard paths?!?

Started bySzyk Cech <szykcech@spoko.pl>
First post2019-08-17 13:58 +0200
Last post2019-08-19 20:57 +0000
Articles 4 on this page of 84 — 15 participants

Back to article view | Back to comp.lang.c++


Contents

  How to get standard paths?!? Szyk Cech <szykcech@spoko.pl> - 2019-08-17 13:58 +0200
    Re: How to get standard paths?!? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-08-17 14:02 +0200
      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 14:05 +0200
        Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 15:11 +0200
          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 15:59 +0200
            Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 16:20 +0200
              Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 16:28 +0200
                Re: How to get standard paths?!? Ralf Goertz <me@myprovider.invalid> - 2019-08-17 16:37 +0200
                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 16:54 +0200
                    Re: How to get standard paths?!? Paavo Helde <myfirstname@osa.pri.ee> - 2019-08-17 18:37 +0300
                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 17:54 +0200
                        Re: How to get standard paths?!? Paavo Helde <myfirstname@osa.pri.ee> - 2019-08-17 19:55 +0300
                          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 19:15 +0200
                            Re: How to get standard paths?!? Paavo Helde <myfirstname@osa.pri.ee> - 2019-08-17 20:39 +0300
                              Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 19:44 +0200
                                Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 20:10 +0200
                                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 08:58 +0200
                                    Re: How to get standard paths?!? Bart <bc@freeuk.com> - 2019-08-18 10:16 +0100
                                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 11:27 +0200
                              Re: How to get standard paths?!? Bo Persson <bo@bo-persson.se> - 2019-08-17 21:07 +0200
                                Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 21:41 +0200
                    Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 17:40 +0200
                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 17:52 +0200
                        Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 18:00 +0200
                          Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 18:01 +0200
                            Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 18:26 +0200
                              Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 20:20 +0200
                                Re: How to get standard paths?!? Keith Thompson <kst-u@mib.org> - 2019-08-17 16:33 -0700
                                  Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 11:34 +0200
                                Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 08:48 +0200
                                  Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 11:34 +0200
                                    Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 12:57 +0200
                                      Re: How to get standard paths?!? Bart <bc@freeuk.com> - 2019-08-18 13:07 +0100
                                        Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 15:49 +0200
                                        Re: How to get standard paths?!? Bo Persson <bo@bo-persson.se> - 2019-08-18 20:33 +0200
                                          Re: How to get standard paths?!? Bart <bc@freeuk.com> - 2019-08-18 20:51 +0100
                                            Re: How to get standard paths?!? Bo Persson <bo@bo-persson.se> - 2019-08-19 00:04 +0200
                                              Re: How to get standard paths?!? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-25 05:35 -0700
                                                Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-25 15:02 +0200
                                                  Re: How to get standard paths?!? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-25 06:38 -0700
                                                    Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-25 15:46 +0200
                                                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-25 15:54 +0200
                                            Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-19 08:52 +0200
                                              Re: How to get standard paths?!? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-08-19 09:32 +0200
                                                Re: How to get standard paths?!? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-22 12:37 -0700
                                              Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-19 10:26 +0200
                        Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 18:00 +0200
                          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 18:06 +0200
                            Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 20:24 +0200
                              Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 08:49 +0200
                                Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 11:46 +0200
                                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 12:59 +0200
                        Re: How to get standard paths?!? scott@slp53.sl.home (Scott Lurndal) - 2019-08-18 15:40 +0000
                          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 17:44 +0200
                    Re: How to get standard paths?!? scott@slp53.sl.home (Scott Lurndal) - 2019-08-18 15:38 +0000
                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 17:46 +0200
                Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 17:56 +0200
                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 18:05 +0200
                    Re: How to get standard paths?!? Hergen Lehmann <hlehmann.expires.5-11@snafu.de> - 2019-08-17 19:47 +0200
                      Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 20:46 +0200
                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 08:54 +0200
                        Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 12:07 +0200
                          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 13:05 +0200
                            Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 14:48 +0200
                              Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 15:51 +0200
                                Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 16:43 +0200
                                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 17:02 +0200
                    Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 20:41 +0200
                      Re: How to get standard paths?!? Keith Thompson <kst-u@mib.org> - 2019-08-17 16:46 -0700
                        Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 12:22 +0200
                      Re: How to get standard paths?!? Robert Wessel <robertwessel2@yahoo.com> - 2019-08-17 22:57 -0500
                      Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 08:57 +0200
                        Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-18 12:24 +0200
                          Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 13:07 +0200
                            Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-18 13:13 +0200
            Re: How to get standard paths?!? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-17 11:22 -0700
              Re: How to get standard paths?!? Bo Persson <bo@bo-persson.se> - 2019-08-17 21:21 +0200
                Re: How to get standard paths?!? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-17 22:25 -0700
                Re: How to get standard paths?!? Robert Wessel <robertwessel2@yahoo.com> - 2019-08-19 01:19 -0500
                  Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-19 08:25 +0200
    Re: How to get standard paths?!? Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-17 14:02 +0200
    Re: How to get standard paths?!? David Brown <david.brown@hesbynett.no> - 2019-08-17 15:13 +0200
    Re: How to get standard paths?!? Sam <sam@email-scan.com> - 2019-08-17 09:21 -0400
    Re: How to get standard paths?!? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-08-19 20:57 +0000

Page 5 of 5 — ← Prev page 1 2 3 4 [5]


#67680

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-08-17 14:02 +0200
Message-ID<qj8qd3$229$1@news.albasani.net>
In reply to#67678
Use the environment-variables %USERPROFILE% or $HOME:
https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system

[toc] | [prev] | [next] | [standalone]


#67684

FromDavid Brown <david.brown@hesbynett.no>
Date2019-08-17 15:13 +0200
Message-ID<qj8uh7$3if$3@dont-email.me>
In reply to#67678
On 17/08/2019 13:58, Szyk Cech wrote:
> Hello!
> 
> I am looking the best way to get system paths in Linux and Windows. 
> Off-course the best will be portable way. Like this:
> https://doc.qt.io/qt-5/qstandardpaths.html
> But I don't want to use Qt. I want to write most of my app in pure C++.
> 
> I am looking for following paths:
> std::wstring gSettingsDir();
> std::wstring gLocalDataDir();
> std::wstring gAppDataDir();
> std::wstring gLogDir();
> std::wstring gTempDir();
> 
> Can you give me some hints how to get them in Linux and Windows?!?
> 
> 
> Thanks in advance and best regards!
> Szyk Cech

If you can use C++17, consider the support in <filesystem> :
<https://en.cppreference.com/w/cpp/header/filesystem>

I haven't tried it myself, but maybe it has what you need.

[toc] | [prev] | [next] | [standalone]


#67686

FromSam <sam@email-scan.com>
Date2019-08-17 09:21 -0400
Message-ID<cone.1566048068.642412.16202.1004@monster.email-scan.com>
In reply to#67678

[Multipart message — attachments visible in raw view] — view raw

Szyk Cech writes:

> Hello!
>
> I am looking the best way to get system paths in Linux and Windows. Off- 
> course the best will be portable way. Like this:
> https://doc.qt.io/qt-5/qstandardpaths.html
> But I don't want to use Qt. I want to write most of my app in pure C++.
>
> I am looking for following paths:
> std::wstring gSettingsDir();
> std::wstring gLocalDataDir();
> std::wstring gAppDataDir();
> std::wstring gLogDir();
> std::wstring gTempDir();
>
> Can you give me some hints how to get them in Linux and Windows?!?

There's no such thing, whatsoever, in Linux. This is all MS-Windows flotsam.  
On Linux, there are some well-known directories, such as /var/tmp for  
temporary files. There's also /tmp, but on most Linux distributions  
applications should use /var/tmp. And that's about it. None of these labels  
resemble anything else on Linux. Now, you do have well-known directories  
like /var/log, where various log files may be found, but application  
normally can't write to it, unless there's some special preparations made in  
advance.

And, of course, all directories and paths on Linux are plain std::string-s.  
Linux code rarely uses std::wstring, that's mostly an MS-Windows plague. In  
the age of internationalization, Linux appears to have converged on UTF-8  
and plain std::strings, with some occasional usage of std::u32string where  
it's convenient to handle text in UTF-32.

[toc] | [prev] | [next] | [standalone]


#67787

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2019-08-19 20:57 +0000
Message-ID<slrnqlm39r.cdo.grahn+nntp@frailea.sa.invalid>
In reply to#67678
On Sat, 2019-08-17, Szyk Cech wrote:
> Hello!
>
> I am looking the best way to get system paths in Linux and Windows. 
> Off-course the best will be portable way. Like this:
> https://doc.qt.io/qt-5/qstandardpaths.html
> But I don't want to use Qt. I want to write most of my app in pure C++.
>
> I am looking for following paths:
> std::wstring gSettingsDir();
> std::wstring gLocalDataDir();
> std::wstring gAppDataDir();

> std::wstring gLogDir();

In Unix you log using syslog(3), not to files.

> std::wstring gTempDir();

For Unix, see tmpfile(3) and similar functions.  Some of them are in
the standard C++ library too.

> Can you give me some hints how to get them in Linux and Windows?!?

This is offtopic, but they don't all exist, not on Linux or Unix in
general, anyway.  Learn the user interface conventions of your
platforms, and write code which follows them -- no API can replace
good taste.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [standalone]


Page 5 of 5 — ← Prev page 1 2 3 4 [5]

Back to top | Article view | comp.lang.c++


csiph-web