]>
git.datanom.net - lensdb.git/blob - src/main.c
4 * Copyright 2024 Michael Rasmussen <mir@datanom.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29 #include <glib/gstdio.h>
30 #include <glib-object.h>
32 #include "sqlite-storage.h"
35 #include "lib/scanner.h"
37 gint
main(gint argc
, gchar
** argv
) {
41 CsvParser* parser = csv_parser_new("/tmp/test.csv", false, true, &err);
43 Record* r = csv_parser_next_line(parser, &err);
45 fprintf(stderr, "[Line: %zu - %s]\n", err->line, err->message);
46 csv_error_clear(&err);
51 r = csv_parser_next_line(parser, &err);
53 fprintf(stderr, "[Line: %zu - %s]\n", err->line, err->message);
54 csv_error_clear(&err);
57 csv_parser_free(parser);
59 fprintf(stderr, "[Line: %zu - %s]\n", err->line, err->message);
60 csv_error_clear(&err);
63 //gchar* path = g_path_get_dirname(argv[0]);
64 gchar
* path
= g_build_filename(g_get_user_config_dir(), PACKAGE
, NULL
); //g_strconcat(g_get_home_dir(), "/.local/share/", PACKAGE, NULL);
65 if (!g_file_test(path
, G_FILE_TEST_EXISTS
| G_FILE_TEST_IS_DIR
)) {
66 if (g_mkdir(path
, 0766)) {
67 fprintf(stderr
, "%s: Failed to create dir for database\n", path
);
72 fprintf(stdout
, "workdir: %s\n", path
);
73 if ((status
= init_storage(path
)) > 0) {
74 fprintf(stderr
, "%s: Failed to open DB\n", path
);
76 gtk_init(&argc
, &argv
);
78 parser = csv_parser_new("/tmp/test.csv", true, true, &err);
82 fprintf(stderr, "[Line: %zu - %s]\n", err->line, err->message);
83 csv_error_clear(&err);
92 gchar
* err
= g_strdup_printf("Failed initializing GUI\n");
94 show_err_msg(GTK_MESSAGE_ERROR
, err
);
This page took 0.891392 seconds and 6 git commands to generate.