Skip to content

Commit

Permalink
将日志目录设置为「用户资料夹\logs」
Browse files Browse the repository at this point in the history
  • Loading branch information
Techince committed Jan 30, 2024
1 parent f02673d commit 04966ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ void _RefreshTrayIcon(const RimeSessionId session_id, const std::function<void()

void RimeWithWeaselHandler::_Setup()
{
auto log_dir{ fs::path(std::format(R"({}\logs)", weasel_user_data_dir())) };
if (!fs::exists(log_dir))
{
fs::create_directories(log_dir);
}
RIME_STRUCT(RimeTraits, weasel_traits);
weasel_traits.shared_data_dir = weasel_shared_data_dir();
weasel_traits.user_data_dir = weasel_user_data_dir();
Expand All @@ -94,6 +99,7 @@ void RimeWithWeaselHandler::_Setup()
weasel_traits.distribution_code_name = WEASEL_CODE_NAME;
weasel_traits.distribution_version = WEASEL_VERSION;
weasel_traits.app_name = "rime.weasel";
weasel_traits.log_dir = log_dir.string().data();
RimeSetup(&weasel_traits);
RimeSetNotificationHandler(&RimeWithWeaselHandler::OnNotify, this);
}
Expand Down
6 changes: 6 additions & 0 deletions WeaselDeployer/Configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Configurator::Configurator()

void Configurator::Initialize()
{
auto log_dir{ fs::path(std::format(R"({}\logs)", weasel_user_data_dir())) };
if (!fs::exists(log_dir))
{
fs::create_directories(log_dir);
}
RIME_STRUCT(RimeTraits, weasel_traits);
weasel_traits.shared_data_dir = weasel_shared_data_dir();
weasel_traits.user_data_dir = weasel_user_data_dir();
Expand All @@ -38,6 +43,7 @@ void Configurator::Initialize()
weasel_traits.distribution_code_name = WEASEL_CODE_NAME;
weasel_traits.distribution_version = WEASEL_VERSION;
weasel_traits.app_name = "rime.weasel";
weasel_traits.log_dir = log_dir.string().data();
RimeSetup(&weasel_traits);

LOG(INFO) << "WeaselDeployer reporting.";
Expand Down
5 changes: 3 additions & 2 deletions WeaselServer/WeaselServer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>false</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -309,7 +309,8 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<DelayLoadDLLs>rime.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>
</DelayLoadDLLs>
<UACUIAccess>false</UACUIAccess>
</Link>
<PostBuildEvent>
Expand Down

0 comments on commit 04966ac

Please sign in to comment.