Solved

program data folder, cross platform

Posted on 2015-01-04
2
205 Views
Last Modified: 2015-01-09
Hi Experts,

What's the best way to get the following folders in a cross-platform manner?  (preferably using boost)?

- program data
- user home
- user roaming folder

Thanks,
Mike
0
Comment
Question by:thready
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 40530323
Unfortunately, there is not really a common way to do that. E.g. there's no such equivalent to 'Program Data' on neither Linux or OS X, nor is there a 'roaming folder'. The most common denominator is probably using environment variables for that purpose, with 'USERPROFILE' representing the 'Home' directory on Window and 'HOME' the one on Linux/OS X. E.g. like

#include <stdlib.h>
#ifdef _WIN32
#define HOMEDIR "USERPROFILE"
#else
#define HOMEDIR "HOME"
#endif

// ...

char* HomePath = getenv(HOMEDIR);

Open in new window

0
 
LVL 1

Author Closing Comment

by:thready
ID: 40540534
Thanks  :)
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Changing the installation path of this MSI 5 107
Need to impress with my knowledge of .NET 5 93
Issues with C++ Class 19 101
FMX TEdit KeyUp handler detecting  "enter" key 4 14
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question