Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions varnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,42 @@ static const char* symbolsFileSearchPath[] = {
const char*
varnam_find_symbols_file_directory()
{
char *tmp;
strbuf *user_path;
int i;

if (varnam_symbols_dir != NULL && is_directory(strbuf_to_s (varnam_symbols_dir))) {
return strbuf_to_s(varnam_symbols_dir);
}

user_path = strbuf_init (20);

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
tmp = getenv ("APPDATA");
if (tmp != NULL) {
strbuf_addf (user_path, "%s\\varnam\\vst\\", tmp);
}
#else
tmp = getenv ("XDG_DATA_HOME");
if (tmp == NULL) {
tmp = getenv ("HOME");
if (tmp != NULL) {
strbuf_addf (user_path, "%s/.local/share/varnam/vst/", tmp);
}
}
else {
strbuf_addf (user_path, "%s/varnam/vst/", tmp);
}
#endif

if (!strbuf_is_blank (user_path)) {
if (is_path_exists (strbuf_to_s (user_path))) {
if (is_directory (strbuf_to_s (user_path))) {
return strbuf_to_s (user_path);
}
}
}

for (i = 0; i < ARRAY_SIZE (symbolsFileSearchPath); i++) {
if (is_directory (symbolsFileSearchPath[i]))
return symbolsFileSearchPath[i];
Expand Down