2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 #include <gconf/gconf-client.h>
25 static char *cc_file_dir;
27 #define ALTOS_DIR_PATH "/apps/aoview/log_dir"
28 #define DEFAULT_DIR "AltOS"
31 cc_file_save_conf(void)
33 GConfClient *gconf_client;
36 gconf_client = gconf_client_get_default();
39 gconf_client_set_string(gconf_client,
43 g_object_unref(G_OBJECT(gconf_client));
48 cc_file_load_conf(void)
51 GConfClient *gconf_client;
54 gconf_client = gconf_client_get_default();
57 file_dir = gconf_client_get_string(gconf_client,
60 g_object_unref(G_OBJECT(gconf_client));
62 cc_file_dir = strdup(file_dir);
67 cc_set_log_dir(char *dir)
69 cc_file_dir = strdup(dir);
78 cc_file_dir = cc_fullname(getenv("HOME"), DEFAULT_DIR);
85 cc_make_filename(int serial, int flight, char *ext)
96 (void) localtime_r(&now, &tm);
97 cc_mkdir(cc_get_log_dir());
101 snprintf(seq, sizeof(seq), "-seq-%03d", sequence);
105 snprintf(base, sizeof (base), "%04d-%02d-%02d-serial-%03d-flight-%03d%s.%s",
113 full = cc_fullname(cc_get_log_dir(), base);
114 r = access(full, F_OK);