121 |
sqlite3* InstrumentsDb::GetDb() { |
sqlite3* InstrumentsDb::GetDb() { |
122 |
if ( db != NULL) return db; |
if ( db != NULL) return db; |
123 |
|
|
124 |
if (DbFile.empty()) DbFile = CONFIG_DEFAULT_INSTRUMENTS_DB_LOCATION; |
if (DbFile.empty()) { |
125 |
|
#ifndef WIN32 |
126 |
|
DbFile = CONFIG_DEFAULT_INSTRUMENTS_DB_LOCATION; |
127 |
|
#else |
128 |
|
char *userprofile = getenv("USERPROFILE"); |
129 |
|
if(userprofile) { |
130 |
|
DbFile = userprofile; |
131 |
|
DbFile += "\\.linuxsampler\\instruments.db"; |
132 |
|
} |
133 |
|
else { |
134 |
|
// in case USERPROFILE is not set (which should not occur) |
135 |
|
DbFile = "instruments.db"; |
136 |
|
} |
137 |
|
#endif |
138 |
|
} |
139 |
#if defined(__APPLE__) /* 20071224 Toshi Nagata */ |
#if defined(__APPLE__) /* 20071224 Toshi Nagata */ |
140 |
if (DbFile.find("~") == 0) |
if (DbFile.find("~") == 0) |
141 |
DbFile.replace(0, 1, getenv("HOME")); |
DbFile.replace(0, 1, getenv("HOME")); |