purrforce/userpaths.c

26 lines
679 B
C

#include <stdlib.h>
#include <string.h>
char servers_ini_buf[260+1];
char app_path_buf[260+1];
#ifdef _MSC_VER
#include <io.h>
const char * get_app_dir(void){
const char *appdata = getenv("APPDATA");
snprintf(app_path_buf,sizeof app_path_buf,"%s",appdata?appdata:".");
return app_path_buf;
}
const char * get_config_file_path(void){
snprintf(servers_ini_buf,sizeof servers_ini_buf,"%s\\purforce\\servers.ini",get_app_dir());
return servers_ini_buf;
}
int path_exists(const char *folder_or_file_path){
int ret = _access(folder_or_file_path,00);//Existence only
return ret==0;
}
void make_dir(const char *folderpath){
_mkdir(folderpath);
}
#endif