Skip to content

Commit 34c6739

Browse files
authored
Fix relative symlink resolution in configuration files (#1425)
Handle relative symlinks properly when resolving configuration file paths.
1 parent a959932 commit 34c6739

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib/fcitx-utils/standardpaths_p.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ class StandardPathsPrivate {
166166
while (--maxDepth && std::filesystem::is_symlink(fullPath, ec)) {
167167
auto linked = std::filesystem::read_symlink(fullPath, ec);
168168
if (!ec) {
169-
fullPath = linked;
169+
if (linked.is_relative()) {
170+
fullPath = fullPath.parent_path() / linked;
171+
} else {
172+
fullPath = linked;
173+
}
170174
} else {
171175
return path;
172176
}

0 commit comments

Comments
 (0)