summaryrefslogtreecommitdiffabout
path: root/src/db.cc
Unidiff
Diffstat (limited to 'src/db.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/db.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db.cc b/src/db.cc
index c350e68..2b4a7eb 100644
--- a/src/db.cc
+++ b/src/db.cc
@@ -1,27 +1,29 @@
1#include <unistd.h> 1#include <unistd.h>
2#include <sys/stat.h> 2#include <sys/stat.h>
3#include <sys/types.h> 3#include <sys/types.h>
4#include <stdlib.h>
5#include <string.h>
4#include <cassert> 6#include <cassert>
5#include <napkin/exception.h> 7#include <napkin/exception.h>
6#include "db.h" 8#include "db.h"
7 9
8#include "config.h" 10#include "config.h"
9 11
10namespace napkin { 12namespace napkin {
11 13
12 extern const char *sql_bootstrap; 14 extern const char *sql_bootstrap;
13 15
14 db_t::db_t() { 16 db_t::db_t() {
15 const char *h = getenv("HOME"); 17 const char *h = getenv("HOME");
16 if(h) { 18 if(h) {
17 datadir = h; 19 datadir = h;
18 datadir += "/."PACKAGE_NAME"/"; 20 datadir += "/."PACKAGE_NAME"/";
19 }else{ 21 }else{
20#if defined(HAVE_GET_CURRENT_DIR_NAME) 22#if defined(HAVE_GET_CURRENT_DIR_NAME)
21 char *cwd = get_current_dir_name(); 23 char *cwd = get_current_dir_name();
22 if(!cwd) 24 if(!cwd)
23 throw napkin::exception("failed to get_current_dir_name()"); 25 throw napkin::exception("failed to get_current_dir_name()");
24 datadir = cwd; 26 datadir = cwd;
25 free(cwd); 27 free(cwd);
26#elif defined(HAVE_GETCWD) 28#elif defined(HAVE_GETCWD)
27 { 29 {