43
42
using namespace std;
49
48
string helppdf = "~\\Startup.pdf";
50
49
string iniexam = "~\\apvlvrc.example";
51
string iconreg = "~\\reg.png";
52
string icondir = "~\\dir.png";
53
string iconpdf = "~\\pdf.png";
50
string iconreg = "~\\icons\\reg.png";
51
string icondir = "~\\icons\\dir.png";
52
string iconpdf = "~\\icons\\pdf.png";
54
53
string inifile = "~\\_apvlvrc";
55
54
string sessionfile = "~\\_apvlvinfo";
57
56
string helppdf = string (DOCDIR) + "/Startup.pdf";
58
57
string iniexam = string (DOCDIR) + "/apvlvrc.example";
59
string iconreg = string (DOCDIR) + "/reg.png";
60
string icondir = string (DOCDIR) + "/dir.png";
61
string iconpdf = string (DOCDIR) + "/pdf.png";
58
string iconreg = string (DOCDIR) + "/icons/reg.png";
59
string icondir = string (DOCDIR) + "/icons/dir.png";
60
string iconpdf = string (DOCDIR) + "/icons/pdf.png";
62
61
string inifile = "~/.apvlvrc";
63
62
string sessionfile = "~/.apvlvinfo";
72
71
if (g_path_is_absolute (path))
74
return g_strdup (path);
73
return g_strdup (path);
77
76
if (*path == '~' && *(path + 1) == PATH_SEP_C)
82
home = g_win32_get_package_installation_directory_of_module (NULL);
81
home = g_win32_get_package_installation_directory_of_module (NULL);
84
home = getenv ("HOME");
87
home = g_get_home_dir ();
83
home = getenv ("HOME");
86
home = g_get_home_dir ();
93
g_snprintf (abpath, sizeof abpath, "%s%s", home, ++path);
97
debug ("Can't find home directory, use current");
98
g_snprintf (abpath, sizeof abpath, "%s", path + 2);
92
g_snprintf (abpath, sizeof abpath, "%s%s", home, ++path);
96
debug ("Can't find home directory, use current");
97
g_snprintf (abpath, sizeof abpath, "%s", path + 2);
105
pwd = g_get_current_dir ();
108
g_snprintf (abpath, sizeof abpath, "%s/%s", pwd, path);
112
debug ("Can't find current directory, use current");
113
g_snprintf (abpath, sizeof abpath, "%s", path);
104
pwd = g_get_current_dir ();
107
g_snprintf (abpath, sizeof abpath, "%s/%s", pwd, path);
111
debug ("Can't find current directory, use current");
112
g_snprintf (abpath, sizeof abpath, "%s", path);
117
116
return g_strdup (abpath);
120
119
gboolean walkdir (const char *name, gboolean (*cb) (const char *, void *),
123
122
GDir *dir = g_dir_open (name, 0, NULL);
126
debug ("Open dir: %s failed", name);
125
debug ("Open dir: %s failed", name);
130
129
const gchar *token;
131
130
while ((token = g_dir_read_name (dir)) != NULL)
133
gchar *subname = g_strjoin (PATH_SEP_S, name, token, NULL);
132
gchar *subname = g_strjoin (PATH_SEP_S, name, token, NULL);
139
if (g_file_test (subname, G_FILE_TEST_IS_REGULAR) == TRUE)
141
if (cb (subname, usrp) == FALSE)
146
else if (g_file_test (subname, G_FILE_TEST_IS_DIR) == TRUE)
148
if (walkdir (subname, cb, usrp) == FALSE)
138
if (g_file_test (subname, G_FILE_TEST_IS_REGULAR) == TRUE)
140
if (cb (subname, usrp) == FALSE)
145
else if (g_file_test (subname, G_FILE_TEST_IS_DIR) == TRUE)
147
if (walkdir (subname, cb, usrp) == FALSE)
155
154
g_dir_close (dir);
195
logv (const char *level, const char *file, int line, const char *func,
194
logv (const char *level, const char *file, int line, const char *func,
198
197
char p[0x1000], temp[0x100];
201
200
g_snprintf (temp, sizeof temp, "[%s] %s: %d: %s(): ",
202
level, file, line, func);
201
level, file, line, func);
204
203
va_start (vap, ms);
205
204
vsnprintf (p, sizeof p, ms, vap);
223
errp ("Can't fork\n");
222
errp ("Can't fork\n");
225
224
else if (pid == 0)
229
while (!isalnum (*str))
232
argv = g_strsplit_set (str, " \t", 0);
238
debug ("Exec path: (%s) argument [%d]\n", argv[0],
239
g_strv_length (argv));
240
ret = execvp (argv[0], argv);
242
errp ("Exec error\n");
228
while (!isalnum (*str))
231
argv = g_strsplit_set (str, " \t", 0);
237
debug ("Exec path: (%s) argument [%d]\n", argv[0],
238
g_strv_length (argv));
239
ret = execvp (argv[0], argv);
241
errp ("Exec error\n");
246
ret = wait4 (pid, &status, 0, NULL);
245
ret = wait4 (pid, &status, 0, NULL);