Folks,
FUNCTION Start( ) AS VOID
LOCAL x AS STRING
? x:= System.Environment.CommandLine
LOCAL Path AS STRING
? Path := System.IO.Path.GetDirectoryName( x)
RETURN
Compiled as a X#-Runtime app, targetting X86 to enable debugging (crashs at runtime equally with "anycpu").
Running, crashes with "illegal charakter in path "C:DevXIDEProjects4BinDebugXSharpRuntimeApp1.exe"
in the GetDirectory call.
Debugging, after setting a breakpoint at the ?Path line, shows that "x" is a empty string with length 1 (!)
Anyone an idea?
Karl
Illegal char?
Illegal char?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Illegal char?
A total and utter guess - could a space have found it's way into x ?
Terry
Terry
Illegal char?
Hi Karl,
It's because that System.Environment.CommandLine returns the command line used to execute the app, and in this case it is XIDE executing it and it always surrounds the executable with double quotes ("), in order to avoid problems with spaces. You may want to remove any such chars, before passing it to a File/Path method, or maybe you could use System.Environment.CurrentDirectory instead?
It's because that System.Environment.CommandLine returns the command line used to execute the app, and in this case it is XIDE executing it and it always surrounds the executable with double quotes ("), in order to avoid problems with spaces. You may want to remove any such chars, before passing it to a File/Path method, or maybe you could use System.Environment.CurrentDirectory instead?
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Illegal char?
Chris,
problem with Current is, that i can't be sure this to be what i "think" it is
Anyway, i already had tried a variant with
x := StrTrans(x, '"', ''), which didn't help - same error.
Initially i had touched some code, about 3 years old <g>:
FullName := System.Environment.CommandLine:Substring(1, System.Environment.CommandLine:IndexOf('"', 1) - 1)
which doesn't want to work anymore ("Out of range, Length can't be less than zero") - this did work all this time, until maybe a month ago it stopped. It's no important functionality, so i didn't bother then, but today i got in the mood...
EDIT: "Now", some hours later than my first report, nothing done with the app, i added the StrTran-Line another time - and now the crash is gone....
Returned to my main app, with the FullName code,
Seems, i'm going mad here, sorry..
Another half an hour later: the initial culprit, why my app's func didn't work anymore is found: the guy, who wrote FreeFileSync apparently changed the commandline params his tool expects.
Grrrrr....
Karl
problem with Current is, that i can't be sure this to be what i "think" it is
Anyway, i already had tried a variant with
x := StrTrans(x, '"', ''), which didn't help - same error.
Initially i had touched some code, about 3 years old <g>:
FullName := System.Environment.CommandLine:Substring(1, System.Environment.CommandLine:IndexOf('"', 1) - 1)
which doesn't want to work anymore ("Out of range, Length can't be less than zero") - this did work all this time, until maybe a month ago it stopped. It's no important functionality, so i didn't bother then, but today i got in the mood...
EDIT: "Now", some hours later than my first report, nothing done with the app, i added the StrTran-Line another time - and now the crash is gone....
Returned to my main app, with the FullName code,
Seems, i'm going mad here, sorry..
Another half an hour later: the initial culprit, why my app's func didn't work anymore is found: the guy, who wrote FreeFileSync apparently changed the commandline params his tool expects.
Grrrrr....
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Illegal char?
Karl
If I've understood things correctly trimming x before submitting to GetDirectoryName(x) maybe worth a try.
Terry
If I've understood things correctly trimming x before submitting to GetDirectoryName(x) maybe worth a try.
Terry