Skip to content

Commit

Permalink
change method weasel_shared_data_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Jan 19, 2024
1 parent b841385 commit 21c10cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions RimeWithWeasel/WeaselUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ const char* weasel_shared_data_dir() {
GetModuleFileNameA(NULL, path, _countof(path));
std::string str_path(path);
size_t k = str_path.find_last_of("/\\");
#ifdef _WIN64
strcpy_s(path + k - 3 , _countof(path) - (k + 3), "data");
#else
strcpy_s(path + k + 1, _countof(path) - (k + 1), "data");
#endif
strcpy_s(path + k + 1, _countof(path) - (k + 1), "data");
return path;
}

Expand Down
7 changes: 6 additions & 1 deletion WeaselDeployer/Configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <rime_levers_api.h>
#pragma warning(default: 4005)
#include <fstream>
#include <regex>
#include "WeaselDeployer.h"

static void CreateFileIfNotExist(std::string filename)
Expand All @@ -35,7 +36,11 @@ Configurator::Configurator()
void Configurator::Initialize()
{
RIME_STRUCT(RimeTraits, weasel_traits);
weasel_traits.shared_data_dir = weasel_shared_data_dir();
std::string shared_data_dir = weasel_shared_data_dir();
#ifdef _WIN64
shared_data_dir = std::regex_replace(shared_data_dir, std::regex("\\\\x64"), "");
#endif
weasel_traits.shared_data_dir = shared_data_dir.c_str();
weasel_traits.user_data_dir = weasel_user_data_dir();
weasel_traits.prebuilt_data_dir = weasel_traits.shared_data_dir;
const int len = 20;
Expand Down

0 comments on commit 21c10cc

Please sign in to comment.