Skip to content

Commit

Permalink
Fixed Lua script special character issue + import pop up
Browse files Browse the repository at this point in the history
  • Loading branch information
tmoroney committed Jan 25, 2025
1 parent 09e0a1d commit 082a13c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
28 changes: 15 additions & 13 deletions AutoSubs-App/src-tauri/resources/AutoSubs V2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ if os_name == "Windows" then
]]

-- Get path to the main AutoSubs app and modules
local install_path = assert(os.getenv("AUTOSUBS_INSTALL_PATH"), "Environment variable AUTOSUBS_INSTALL_PATH not set")
-- Convert the install path to a wide-character string (handle Unicode characters)
install_path = to_wide_string(install_path)
storage_path = os.getenv("APPDATA") .. "\\Blackmagic Design\\DaVinci Resolve\\Support\\Fusion\\Scripts\\Utility\\AutoSubs\\"
local install_path = assert(read_file(storage_path .. "install_path.txt"))
main_app = install_path .. "\\AutoSubs.exe"
storage_path = install_path .. "\\resources\\AutoSubs\\"
modules_path = install_path .. "\\resources\\modules\\"
Expand Down Expand Up @@ -254,16 +253,19 @@ function GetTemplates()
FindAllTemplates(rootFolder)
-- Add default template to mediapool if not available
if defaultTemplateExists == false then
local success, err = pcall(function()
mediaPool:ImportFolderFromFile(storage_path .. "subtitle-template.drb")
local clipName = "Default Template"
local newTemplate = {
label = clipName,
value = clipName
}
table.insert(templates, newTemplate)
end)
defaultTemplateExists = true
if tonumber(resolve:GetVersion()[1]) >= 19 then
print("Default template not found. Importing default template...")
local success, err = pcall(function()
mediaPool:ImportFolderFromFile(storage_path .. "subtitle-template.drb")
local clipName = "Default Template"
local newTemplate = {
label = clipName,
value = clipName
}
table.insert(templates, newTemplate)
end)
end
defaultTemplateExists = true -- don't try to import again
end
return templates
end
Expand Down
2 changes: 1 addition & 1 deletion AutoSubs-App/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2.0.0",
"productName": "AutoSubs",
"version": "2.1.7",
"version": "2.1.8",
"identifier": "com.autosubs.app",
"build": {
"beforeDevCommand": "npm run dev",
Expand Down
7 changes: 4 additions & 3 deletions AutoSubs-App/src-tauri/windows/hooks.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
CopyFiles "$INSTDIR\resources\AutoSubs V2.lua" "$APPDATA\Blackmagic Design\DaVinci Resolve\Support\Fusion\Scripts\Utility"
CopyFiles "$INSTDIR\resources\AutoSubs" "$APPDATA\Blackmagic Design\DaVinci Resolve\Support\Fusion\Scripts\Utility"

; Set the installation path as an environment variable
WriteRegStr HKCU "Environment" "AUTOSUBS_INSTALL_PATH" "$INSTDIR"
System::Call 'Kernel32::SendMessageTimeoutA(i 0xFFFF, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0, i 5000, *i .r0)'
; Write the installation path to a simple text file
FileOpen $0 "$APPDATA\Blackmagic Design\DaVinci Resolve\Support\Fusion\Scripts\Utility\AutoSubs\install_path.txt" w
FileWrite $0 $INSTDIR
FileClose $0
!macroend
1 change: 1 addition & 0 deletions package-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ Write-Host "All files have been signed successfully."

# Navigate to AutoSubs-App and build the Tauri app
Set-Location -Path "./AutoSubs-App"
npm install
npm run tauri build

0 comments on commit 082a13c

Please sign in to comment.