Comments (2)
it's a mess
https://stackoverflow.com/questions/5123361/finding-library-application-support-from-c
from jellycram.
This code functions in a .app bundle which comes from apple... https://developer.apple.com/library/archive/qa/qa1549/_index.html
#include <glob.h>
#include <string>
#include <iostream>
#include <fstream>
#include <filesystem>
char* CreatePathByExpandingTildePath(char* path)
{
glob_t globbuf;
char **v;
char *expandedPath = NULL, *result = NULL;
if (path == NULL) { return "NULL"; }
if (glob(path, GLOB_TILDE, NULL, &globbuf) == 0) //success
{
v = globbuf.gl_pathv; //list of matched pathnames
expandedPath = v[0]; //number of matched pathnames, gl_pathc == 1
result = (char*)calloc(1, strlen(expandedPath) + 1); //the extra char is for the null-termination
if(result)
strncpy(result, expandedPath, strlen(expandedPath) + 1); //copy the null-termination as well
globfree(&globbuf);
}
return result;
}
int main()
{
std::string home = CreatePathByExpandingTildePath("~/");
std::cout << home << std::endl;
std::string support = home+"Library/Application Support/t";
if (!std::filesystem::exists(support)) { std::filesystem::create_directory(support); }
std::ofstream out(support+"/data.json");
out << "{ \"some\": 1 }";
out.close();
}
from jellycram.
Related Issues (20)
- macOS crashes on checkDelete HOT 1
- score achievements did not seem to work HOT 4
- preview pulses when deleting
- invert rotation controls option
- tutorial tip the game gets harder
- android controls and setup
- swipe adds a small push in x-axis HOT 1
- only flash that which will be deleted HOT 2
- android touch target size
- Dark/Light mode
- Block colours
- Bug report: blank screen
- Update desktop icon
- Tutorial should be hidden on desktop when menu active
- Clears counter, and android leaderboard/achievements
- Desktop unpauses if menu is selected
- windows use ico
- windows cuts of some of screen
- Bug report: [Inverted Tap Controls Drop Instead Of Float] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jellycram.