Skip to content

Commit

Permalink
SAPI5: copy the initial configuration file to %APPDATA%\RHVoice.
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga-Yakovleva committed Aug 31, 2020
1 parent 5eed3a1 commit efac9bf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Expand Up @@ -27,7 +27,7 @@ if sys.platform=="win32":
import _winreg as winreg

def get_version(is_release):
next_version="1.2.0"
next_version="1.2.1"
return next_version

def CheckPKGConfig(context):
Expand Down
13 changes: 12 additions & 1 deletion src/sapi/tts_base.cpp
Expand Up @@ -59,7 +59,18 @@ namespace RHVoice
p.resource_paths=get_resource_paths();
wchar_t appdata_path[MAX_PATH];
if(SHGetFolderPath(0,CSIDL_APPDATA,0,SHGFP_TYPE_CURRENT,appdata_path)==S_OK)
p.config_path=path::join(utils::wstring_to_string(appdata_path),"RHVoice");
{
std::wstring config_path=std::wstring(appdata_path)+std::wstring(L"\\RHVoice");
p.config_path=utils::wstring_to_string(config_path);
wchar_t common_appdata_path[MAX_PATH];
if(SHGetFolderPath(0,CSIDL_COMMON_APPDATA,0,SHGFP_TYPE_CURRENT,common_appdata_path)==S_OK)
{
std::wstring in_file_path=std::wstring(common_appdata_path)+std::wstring(L"\\Olga Yakovleva\\RHVoice\\config\\RHVoice.ini");
CreateDirectory(config_path.c_str(), nullptr);
std::wstring out_file_path(config_path+L"\\RHVoice.ini");
CopyFile(in_file_path.c_str(), out_file_path.c_str(), true);
}
}
engine_ptr=engine::create(p);
return engine_ptr;
}
Expand Down
25 changes: 25 additions & 0 deletions src/wininst/SConscript
Expand Up @@ -32,6 +32,8 @@ class core_packager(RHVoicePackaging.windows.msi_packager):
super(core_packager,self).__init__(upgrade_code,name,outdir,env,display_name,version,"RHVoice")
self.dll=Dir("..").Dir("x86_64" if x64_flag else "x86").Dir("sapi").File("RHVoiceSvr.dll")
env.Depends(self.outfile,self.dll)
self.ini=Dir("..").File("RHVoice.ini")
env.Depends(self.outfile,self.ini)
self.token_enum_key=r"Software\Microsoft\Speech\Voices\TokenEnums\RHVoice"
self.token_enum_clsid="{d7577808-7ade-4dea-a5b7-ee314d6ef3a1}"
self.engine_clsid="{9f215c97-3d3b-489d-8419-6b9abbf31ec2}"
Expand Down Expand Up @@ -88,6 +90,28 @@ class core_packager(RHVoicePackaging.windows.msi_packager):
lib_path=os.path.join(self.get_old_lib_dir_path(win64),"RHVoiceSvr.dll")
self.create_remove_file_component_element(lib_path)

def create_ini_component(self):
dir=self.SubElement(self.root_directory,"Directory")
dir.set("Id","CommonAppDataFolder")
dir=self.SubElement(dir,"Directory")
dir.set("Id","MyAppDataFolder")
dir.set("Name",self.product.get("Manufacturer"))
dir=self.SubElement(dir,"Directory")
dir.set("Id","RHVoiceDataFolder")
dir.set("Name","RHVoice")
dir=self.SubElement(dir,"Directory")
dir.set("Id","RHVoiceConfigFolder")
dir.set("Name","config")
cmp=self.SubElement(dir,"Component")
file=self.SubElement(cmp,"File",empty=True)
file.set("Id","RHVoiceIni")
cmp.set("Id","cmp_"+file.get("Id"))
cmp.set("Guid","*")
cmp.set("Feature","Main")
file.set("KeyPath","yes")
file.set("Name","RHVoice.ini")
file.set("Source",self.ini.abspath)

def do_package(self):
self.create_com_server_component_element()
self.create_token_enum_component_element()
Expand All @@ -97,6 +121,7 @@ class core_packager(RHVoicePackaging.windows.msi_packager):
self.create_remove_file_component_element(os.path.join("config-examples","RHVoice.ini"))
self.create_remove_nsis_uninstaller_component_element()
self.create_remove_folder_component_elements()
self.create_ini_component()

msi32=core_packager("3794ffaa-7bc4-48cb-ae7d-67cb2560398a",False)
msi32.package()
Expand Down

0 comments on commit efac9bf

Please sign in to comment.