Add new flags to asset stream manager (#10)

- Add --config-file option defining Json configuration file for asset stream manager
- Add log_dir flag for log folder
- Remove unused functions from SdkUtils
- Fix build issue in cdc_fuse_fs
This commit is contained in:
wurwunchik
2022-11-22 12:05:48 +01:00
committed by GitHub
parent 0252d51cc0
commit b2c011cc0d
6 changed files with 32 additions and 73 deletions

View File

@@ -35,21 +35,6 @@ SdkUtil::SdkUtil() {
SdkUtil::~SdkUtil() = default;
std::string SdkUtil::GetUserConfigPath() const {
assert(init_status_.ok());
return path::Join(roaming_appdata_path_, "GGP");
}
std::string SdkUtil::GetServicesConfigPath() const {
return path::Join(GetUserConfigPath(), "services");
}
std::string SdkUtil::GetLogPath(const char* log_base_name) const {
DefaultSystemClock clock;
std::string timestamp_ext = clock.FormatNow(".%Y%m%d-%H%M%S.log", false);
return path::Join(GetUserConfigPath(), "logs", log_base_name + timestamp_ext);
}
std::string SdkUtil::GetDevBinPath() const {
return path::Join(ggp_sdk_path_env_, "dev", "bin");
}

View File

@@ -35,22 +35,6 @@ class SdkUtil {
SdkUtil();
~SdkUtil();
// Returns the initialization status. Should be OK unless in case of some rare
// internal error. Should be checked before accessing any members.
const absl::Status& GetInitStatus() const { return init_status_; }
// Returns the path of the SDK user configuration, e.g.
// %APPDATA%\GGP.
std::string GetUserConfigPath() const;
// Returns the path of the SDK services configuration, e.g.
// %APPDATA%\GGP\services.
std::string GetServicesConfigPath() const;
// Returns the path of a log file with given |log_base_name|, e.g.
// %APPDATA%\GGP\logs\log_base_name.20210729-125930.log.
std::string GetLogPath(const char* log_base_name) const;
// Returns the path of the dev tools that ship with the SDK, e.g.
// C:\Program Files\GGP SDK\dev\bin.
std::string GetDevBinPath() const;

View File

@@ -63,19 +63,6 @@ class SdkUtilTest : public ::testing::Test {
std::vector<std::string> test_created_directories_;
};
TEST_F(SdkUtilTest, CheckRoamingAppDataPaths) {
SdkUtil sdk_util;
EXPECT_OK(sdk_util.GetInitStatus());
std::string appdata_dir;
EXPECT_OK(
path::GetKnownFolderPath(path::FolderId::kRoamingAppData, &appdata_dir));
const std::string ggp_path = path::Join(appdata_dir, "GGP");
EXPECT_EQ(sdk_util.GetUserConfigPath(), ggp_path);
EXPECT_EQ(sdk_util.GetServicesConfigPath(), path::Join(ggp_path, "services"));
}
TEST_F(SdkUtilTest, CheckSdkPathsWithoutGgpSdkPathEnv) {
// Clear environment variable and figure out default SDK dir.
EXPECT_OK(path::SetEnv("GGP_SDK_PATH", ""));
@@ -85,17 +72,6 @@ TEST_F(SdkUtilTest, CheckSdkPathsWithoutGgpSdkPathEnv) {
const std::string sdk_dir = path::Join(program_files_dir, "GGP SDK");
SdkUtil sdk_util;
EXPECT_OK(sdk_util.GetInitStatus());
CheckSdkPaths(sdk_util, sdk_dir);
}
TEST_F(SdkUtilTest, CheckSdkPathsWithGgpSdkPathEnv) {
// Set a path with unicode character.
std::string sdk_dir = u8"C:\\I\\\\GGP SDK\\";
EXPECT_OK(path::SetEnv("GGP_SDK_PATH", sdk_dir));
SdkUtil sdk_util;
EXPECT_OK(sdk_util.GetInitStatus());
CheckSdkPaths(sdk_util, sdk_dir);
}