issue 87 : another try

git-svn-id: http://tint2.googlecode.com/svn/trunk@80 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2009-05-31 17:32:49 +00:00
parent e43bf23b67
commit a081c0a57d
2 changed files with 19 additions and 2 deletions

View file

@ -140,10 +140,27 @@ void init_battery()
}
}
if (battery_dir != 0) {
path_energy_now = g_build_filename(battery_dir, "energy_now", NULL);
path_energy_full = g_build_filename(battery_dir, "energy_full", NULL);
char *path1 = g_build_filename(battery_dir, "energy_now", NULL);
if (g_file_test (path1, G_FILE_TEST_EXISTS)) {
path_energy_now = g_build_filename(battery_dir, "energy_now", NULL);
path_energy_full = g_build_filename(battery_dir, "energy_full", NULL);
}
else {
char *path2 = g_build_filename(battery_dir, "charge_now", NULL);
if (g_file_test (path2, G_FILE_TEST_EXISTS)) {
path_energy_now = g_build_filename(battery_dir, "charge_now", NULL);
path_energy_full = g_build_filename(battery_dir, "charge_full", NULL);
}
else {
g_free(battery_dir);
battery_dir = 0;
fprintf(stderr, "ERROR: can't found energy_* or charge_*\n");
}
g_free(path2);
}
path_current_now = g_build_filename(battery_dir, "current_now", NULL);
path_status = g_build_filename(battery_dir, "status", NULL);
g_free(path1);
}
FILE *fp;

BIN
src/tint2

Binary file not shown.