1 --- src/loadsave.cc.orig 2008-11-16 21:06:54.954719930 +0800
2 +++ src/loadsave.cc 2008-11-16 21:16:50.287993666 +0800
6 //initialize by default
7 - strcpy(channels_url, "http://www.sopcast.com/gchlxml");
8 + strcpy(channels_url, "http://www.sopcast.cn/gchlxml");
9 strcpy(channels_url_header, "sop://");
10 strcpy(record_dir, getenv("HOME"));
11 strcat(record_dir, "/SOPCAST/");
14 char *strtok_buffer = NULL;
16 - std::string data_path = getenv("HOME");
17 - data_path += "/.gsopcast/config";
18 + std::string data_path;
19 + if( getenv("XDG_CONFIG_HOME") != NULL ){
20 + data_path = getenv("XDG_CONFIG_HOME");
21 + data_path += "/gsopcast/config";
24 + data_path = getenv("HOME");
25 + data_path += "/.config/gsopcast/config";
27 FILE *fp = fopen(data_path.c_str(), "r");
31 //-----------------------------------------------------
34 - std::string data_path = getenv("HOME");
35 - data_path += "/.gsopcast/";
36 + std::string data_path;
37 + if( getenv("XDG_CONFIG_HOME") != NULL ){
38 + data_path = getenv("XDG_CONFIG_HOME");
39 + data_path += "/gsopcast/";
42 + data_path = getenv("HOME");
43 + data_path += "/.config/gsopcast/";
45 if (access(data_path.c_str(), F_OK))
46 mkdir(data_path.c_str(), S_IRWXU);
47 data_path += "config";
49 memset(tree_state, 0, sizeof(tree_state));
50 memset(org_tree_state, 0, sizeof(org_tree_state));
52 - std::string data_path = getenv("HOME");
53 - data_path += "/.gsopcast/tree";
54 + std::string data_path;
55 + if( getenv("XDG_CONFIG_HOME") != NULL ){
56 + data_path = getenv("XDG_CONFIG_HOME");
57 + data_path += "/gsopcast/tree";
60 + std::string data_path = getenv("HOME");
61 + data_path += "/.config/gsopcast/tree";
64 FILE *fp = fopen(data_path.c_str(), "r");
67 if (memcmp(tree_state, org_tree_state, sizeof(tree_state))) ////if different
70 - std::string data_path = getenv("HOME");
71 - data_path += "/.gsopcast/";
72 + std::string data_path;
73 + if( getenv("XDG_CONFIG_HOME") != NULL ){
74 + data_path = getenv("XDG_CONFIG_HOME");
75 + data_path += "/gsopcast/";
78 + data_path = getenv("HOME");
79 + data_path += "/.config/gsopcast/";
81 if (access(data_path.c_str(), F_OK))
82 mkdir(data_path.c_str(), S_IRWXU);