Skip to content

Commit

Permalink
Make g3 LocalAppDataPath match .NET path.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 700180665
  • Loading branch information
ftsui authored and copybara-github committed Nov 26, 2024
1 parent b46cbc6 commit 9920121
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/platform/implementation/g3/device_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#ifndef PLATFORM_IMPL_G3_DEVICE_INFO_H_
#define PLATFORM_IMPL_G3_DEVICE_INFO_H_

#include <filesystem>
#include <cstdlib>
#include <filesystem> // NOLINT
#include <functional>
#include <optional>
#include <string>
Expand Down Expand Up @@ -47,7 +48,12 @@ class DeviceInfo : public api::DeviceInfo {
}

std::optional<std::filesystem::path> GetLocalAppDataPath() const override {
return std::filesystem::temp_directory_path();
const char* home_dir = getenv("HOME");
if (home_dir == nullptr) {
return std::filesystem::temp_directory_path();
}
// Yhis matches the .NET LocalAppData directory on Linux.
return std::filesystem::path(home_dir).append(".local").append("share");
}

std::optional<std::filesystem::path> GetCommonAppDataPath() const override {
Expand Down

0 comments on commit 9920121

Please sign in to comment.