brndx Posted July 5, 2017 Share Posted July 5, 2017 Hi, I'm setting up steam cloud saves and need to know if the method AppDataPath() which returns %USERPROFILE%/AppData/Local/ on Windows will return ~/ on Linux making the settings below correct. Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 5, 2017 Share Posted July 5, 2017 From what it looks like, it seems like your making a new directory under root. I recall LE storing the AppData folder under /home/USER/. The user doesn't have permission to access anything outside their home folder by default. Also, the folder is hidden with a period at the start. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted July 5, 2017 Share Posted July 5, 2017 On Linux this command returns the results of a call to getenv("HOME"). I believe this is equivalent to "~/". Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Ma-Shell Posted July 5, 2017 Share Posted July 5, 2017 Actually, for linux "~" doesn't have any meaning at all... expanding "~" to the current user's home-directory is a feature of most shells (bash, zsh, ...). This means, if you type "~" in the terminal, the shell that is executing in the terminal replaces this by the user's home-directory. However, if you try to use "~" from your program, it will not mean anything to linux and your program can't do anything with it. Look at the following example-terminal session: $ echo foo > ~/bar $ cat ~/bar foo $ python Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> f = open("~/bar") Traceback (most recent call last): File "<stdin>", line 1, in <module> IOError: [Errno 2] No such file or directory: '~/bar' >>> f = open("/home/user/bar") >>> As you can see, e.g. Python can't find the file "~/bar", since "~" doesn't mean anything to it. Using the complete path, however, works. The same would hold for your Leadwerks LUA/C++ project: You can't use "~" to refer to the current user's home directory. Using the result of getenv("HOME"), as Josh mentioned, is the correct way to get the home-directory. (And yes, for the SHELL it is equivalent to "~/", but for your program) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.