jamiaccount: try hard linking first when linking to VCard

For an account's VCard, we store the actual VCard file in the account's
profile directory, alongside other contact profile files, and a link is
created in the account's directory to the VCard file that is named using
the base64-encoded account URI. This method will fail on Windows where
users can not create soft links.

When linking to this VCard file, we first try to hard link to it. If
that fails, we fall back to symlinking to it. This allows the new
profile linking mechanism to work on Windows, and we are fairly
confident that the `profiles` sub dir will not be on a different
filesystem.

https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/1899
Change-Id: I3be8150b02f8427c164beb6c652f96d895aab048
This commit is contained in:
Andreas Traczyk
2025-02-26 13:59:02 -05:00
parent c3f07d730d
commit d5ce21e39b

View File

@ -3464,7 +3464,7 @@ JamiAccount::updateProfile(const std::string& displayName,
file << vCard::utils::toString(profile); file << vCard::utils::toString(profile);
file.close(); file.close();
std::filesystem::rename(tmpPath, vCardPath); std::filesystem::rename(tmpPath, vCardPath);
fileutils::createFileLink(path, vCardPath); fileutils::createFileLink(path, vCardPath, true);
emitSignal<libjami::ConfigurationSignal::ProfileReceived>(getAccountID(), emitSignal<libjami::ConfigurationSignal::ProfileReceived>(getAccountID(),
accountUri, accountUri,
path.string()); path.string());