Permalink
Browse files

add error detection for CP, plus bugfix

  • Loading branch information...
1 parent df5c01d commit 760c298a35b8b9dad7d144e9ac650975cd6956ca @joedf joedf committed Dec 3, 2015
Showing with 15 additions and 3 deletions.
  1. +4 −0 Ahk2Exe.ahk
  2. +8 −1 Compiler.ahk
  3. +3 −2 ErrorCodes.md
View
@@ -29,6 +29,7 @@ if CLIMode
IcoFile = %LastIcon%
BinFileId := FindBinFile(LastBinFile)
+ScriptFileCP := "UTF-8"
#include *i __debug.ahk
@@ -480,6 +481,9 @@ Util_ErrorCode(x)
if InStr(x,"icon")
return 0x42
+ if InStr(x,"codepage")
+ return 0x53
+
return 0x1 ;unknown error
}
View
@@ -48,7 +48,14 @@ AhkCompile(ByRef AhkFile, ExeFile="", ByRef CustomIcon="", BinFile="", UseMPRESS
BundleAhkScript(ExeFile, AhkFile, IcoFile="", fileCP := "UTF-8")
{
- FileEncoding, %fileCP%
+ ; weird bug prevention, for non working default param 'fileCP'
+ if fileCP is space
+ fileCP := "UTF-8"
+
+ try FileEncoding, %fileCP%
+ catch e
+ Util_Error("Error: Invalid codepage parameter """ fileCP """ was given.")
+
SplitPath, AhkFile,, ScriptDir
ExtraFiles := []
View
@@ -41,7 +41,8 @@ Possible Errors
- `(0x5)` Error: Could not copy final compiled binary file to destination.
-### `(0x50+)` Miscellaneous & GUI only
+### `(0x50+)` Miscellaneous
- `(0x1)` You cannot drop more than one file into this window!
-- `(0x2)` Error: cannot find AutoHotkey help file!
+- `(0x2)` Error: cannot find AutoHotkey help file!
+- `(0x3)` Error: Invalid codepage parameter was given.

0 comments on commit 760c298

Please sign in to comment.