/* see http://www.opennetcf.org/Forums/post.asp?method=TopicQuote&TOPIC_ID=95&FORUM_ID=12 for more possibilities return false on failure, true if ok. Even if returns false, it'll return root ("\") directory so that clients can ignore failures from this function */ TCHAR *get_app_data_folder_path(BOOL f_create) { #ifdef SPECIAL_FOLDER_PATH BOOL f_ok; TCHAR path[MAX_PATH]; f_ok = SHGetSpecialFolderPath(NULL, path, SPECIAL_FOLDER_PATH, f_create); if (f_ok) return tstr_dup(path); else return tstr_dup(_T("")); #else /* if all else fails, just use root ("\") directory */ return tstr_dup(_T("")); #endif }
/* start logging to a file 'fileName'. From now on until slog_file_log_stop() all slog* logging will also go to a file. If a file of that name already exists, it'll overwrite it. */ BOOL slog_file_log_start(const TCHAR *fileName) { if (!fileName) return FALSE; g_cur_fileName = tstr_dup(fileName); DeleteFile(fileName); return TRUE; }
TCHAR *load_string_dup(int str_id) { TCHAR buf[BUF_CCH_SIZE] = {0}; LoadString(NULL, str_id, buf, BUF_CCH_SIZE); if (0 == tstr_len(buf)) { assert(0); return NULL; } return tstr_dup(buf); }