Skip to content

Commit 8f10c5f

Browse files
committed
Change writeable dir search order
First tries in appdata, then in executable dir. Fixes #16 - Put log file under %appdata% or ability to specify path?
1 parent 522045c commit 8f10c5f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ The available settings correspond to some of the above features. The settings ar
111111
minimized.
112112
- **Enable log file**:
113113
This toggles whether Finestray saves logging information to a file or not. If enabled, Finestray first tries to save
114-
the log file in the same location as the Finestray application, and if that's not possible it saves to
115-
`%LOCALAPPDATA%\\Finestray\\Finestray.log`.
114+
the log file to `%LOCALAPPDATA%\\Finestray\\Finestray.log`, and if that's not possible it saves in the same location
115+
as the Finestray application.
116116
- **Minimize placement**:
117117
This controls where to place minimized windows minimized using Finestray. The choices are:
118118
- **Tray**: the window will get an icon in the tray.
@@ -164,9 +164,9 @@ At the bottom of the Settings dialog are six buttons: Help, About, Reset, Exit,
164164
- **OK**:
165165
Closes the Settings window and saves settings.
166166

167-
Settings are automatically stored in a file called "Finestray.json". Finestray first tries to save them in the same
168-
location as the Finestray application, and if that's not possible it saves them to
169-
`%LOCALAPPDATA%\\Finestray\\Finestray.json`.
167+
Settings are automatically stored in a file called "Finestray.json". Finestray first tries to save them to
168+
`%LOCALAPPDATA%\\Finestray\\Finestray.json`, and if that's not possible it saves them in the same location as the
169+
Finestray application.
170170

171171
### Modifiers and Hotkeys
172172

src/Path.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ std::string getWriteableDir()
139139

140140
std::string dir;
141141

142-
dir = getExecutableDir();
143-
if (!dir.empty() && checkWriteableDir(dir)) {
144-
DEBUG_PRINTF("using executable dir '%s' as writeable dir\n", dir.c_str());
145-
writeableDir_ = dir;
146-
return dir;
147-
}
148-
149142
dir = getAppDataDir();
150143
if (!dir.empty()) {
151144
dir = pathJoin(dir, APP_NAME);
@@ -166,6 +159,13 @@ std::string getWriteableDir()
166159
}
167160
}
168161

162+
dir = getExecutableDir();
163+
if (!dir.empty() && checkWriteableDir(dir)) {
164+
DEBUG_PRINTF("using executable dir '%s' as writeable dir\n", dir.c_str());
165+
writeableDir_ = dir;
166+
return dir;
167+
}
168+
169169
WARNING_PRINTF("no writeable dir found\n");
170170
return std::string();
171171
}

0 commit comments

Comments
 (0)