Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS files #81

Closed
2 tasks done
Jerboa-app opened this issue Apr 9, 2024 · 2 comments · Fixed by #82
Closed
2 tasks done

macOS files #81

Jerboa-app opened this issue Apr 9, 2024 · 2 comments · Fixed by #82
Labels
bug Something isn't working macOS

Comments

@Jerboa-app
Copy link
Contributor

Jerboa-app commented Apr 9, 2024

  • icons are not found in macOS
  • settings.json is not found in macOS (tutorial is always active)
@Jerboa-app Jerboa-app added bug Something isn't working macOS labels Apr 9, 2024
@Jerboa-app Jerboa-app mentioned this issue Apr 9, 2024
@Jerboa-app
Copy link
Contributor Author

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();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant