-
Notifications
You must be signed in to change notification settings - Fork 1
Consolidate all 22 open PRs: DI/testability, perf, SetTimer, path fixes, regex escaping #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7914133
d38532e
51e9bcf
df4e4fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,11 +16,12 @@ root := OneDrive "\Backup\Game\Emul\Citra\nightly-mingw\Mods" | |
|
|
||
| ; Read CSV once and cache destinations in an associative array | ||
| Destinations := {} | ||
| loop Read, % A_ScriptDir "\Destination.csv" | ||
| FileRead, csvContent, % A_ScriptDir "\Destination.csv" | ||
| loop Parse, csvContent, `n, `r | ||
| { | ||
| if (InStr(A_LoopReadLine, ",")) | ||
| if (InStr(A_LoopField, ",")) | ||
| { | ||
| parts := StrSplit(A_LoopReadLine, ",") | ||
| parts := StrSplit(A_LoopField, ",") | ||
| if (parts.Length() >= 2) | ||
| Destinations[parts[1]] := parts[2] | ||
| } | ||
|
|
@@ -61,12 +62,7 @@ FileActions(Root, Button) | |
| Fullpath := Zielpfad "\" button.Ziel "\" button.Name | ||
| Checkdir := Zielpfad "\" button.Ziel | ||
| Quellpfad := button.Path | ||
| dirHasItems := false | ||
| Loop, Files, %Checkdir%\*, DF ;Loop through items in dir | ||
| { | ||
| dirHasItems := true ;Mark that we found at least one item | ||
| Break ;Optimization: Break after finding the first item | ||
| } | ||
| dirHasItems := FileExist(Checkdir "\*") != "" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an AutoHotkey v1 script. In AutoHotkey v1, |
||
| If !dirHasItems ;Is directory empty? | ||
| { | ||
| FileCopyDir, %Quellpfad%, %Fullpath% | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| ; Escaped string safe for use in regex patterns | ||
| ; ============================================================================ | ||
| RegExEscape(str) { | ||
| return RegExReplace(str, "([\\()\[\]{}?*+|^$.])", "\$1") | ||
| return RegExReplace(str, "([\\()\[\]{}?*+|^$.})", "\\$1") | ||
| } | ||
|
Comment on lines
20
to
22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The closing square bracket |
||
|
|
||
| ; ============================================================================ | ||
|
|
@@ -36,9 +36,9 @@ RegExEscape(str) { | |
| ; Modified configuration content | ||
| ; ============================================================================ | ||
| SetKey(content, key, value) { | ||
| pat := "m)^(" . RegExEscape(key) . ")\s*=.*$" | ||
| pat := "m)^(" . RegExEscape(key) . ")\\s*=.*$" | ||
| if RegExMatch(content, pat) | ||
| return RegExReplace(content, pat, "$1=" value, , 1) | ||
| return RegExReplace(content, pat, "$1=" StrReplace(value, "$", "$$"), , 1) | ||
| else | ||
| return content "`n" key "=" value | ||
| } | ||
|
Comment on lines
38
to
44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In AutoHotkey |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,7 @@ PlayBootVideo() { | |
| vlcPath := MustGetExe("vlc.exe", ["C:\Program Files\VideoLAN\VLC\vlc.exe"]) | ||
| bootVideo := A_ScriptDir . "\BootVideo.mp4" | ||
| vlcArgs := '--fullscreen --video-on-top --play-and-exit --no-video-title -Idummy "' . bootVideo . '"' | ||
| RunWait('cmd.exe /c START "" "' . vlcPath . '" ' . vlcArgs, , "hide") | ||
| DllCall("kernel32.dll\Sleep", "UInt", 3000) | ||
| RunWait('"' . vlcPath . '" ' . vlcArgs, , "hide") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| } | ||
| LaunchPlaynite() { | ||
| playniteExe := MustGetExe( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In AutoHotkey v2, the native
WinWaitfunction throws aTimeoutErrorwhen it times out. By removing thetry-catchblock,WaitForWindowwill propagate this unhandled exception to the caller instead of returningfalseas expected. We should restore thetry-catchblock to handle the timeout gracefully.