Skip to content

Commit b4405d7

Browse files
authored
Make standardpath compile on win32 (#1312)
The plan was to replace it with a new version of the class, but we want to make it compile.
1 parent 8af72c5 commit b4405d7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Standard: Cpp11
4141
IndentWidth: 4
4242
TabWidth: 4
4343
UseTab: Never
44+
LineEnding: LF
4445
BreakBeforeBraces: Attach
4546
SpacesInParentheses: false
4647
SpacesInAngles: false

src/lib/fcitx-utils/standardpath.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ class StandardPathPrivate {
223223
dir = stringutils::joinPath(*home, defaultPath);
224224
} else {
225225
if (env && strcmp(env, "XDG_RUNTIME_DIR") == 0) {
226+
#ifdef _WIN32
227+
dir = stringutils::joinPath(
228+
defaultPath, stringutils::concat("fcitx-runtime"));
229+
#else
226230
dir = stringutils::joinPath(
227231
defaultPath,
228232
stringutils::concat("fcitx-runtime-", geteuid()));
@@ -231,19 +235,22 @@ class StandardPathPrivate {
231235
return {};
232236
}
233237
}
238+
#endif
234239
} else {
235240
dir = defaultPath;
236241
}
237242
}
238243
}
239244

245+
#ifndef _WIN32
240246
if (!dir.empty() && env && strcmp(env, "XDG_RUNTIME_DIR") == 0) {
241247
struct stat buf;
242248
if (stat(dir.c_str(), &buf) != 0 || buf.st_uid != geteuid() ||
243249
(buf.st_mode & 0777) != S_IRWXU) {
244250
return {};
245251
}
246252
}
253+
#endif
247254
return dir;
248255
}
249256

0 commit comments

Comments
 (0)