SET DEFAULt TO <xxx> behaviour
Posted: Thu May 06, 2021 1:22 pm
Guys,
it´s no final solution, i just collected what i've noticed so far ...
In the early Foxpro days there's been no CD - (C)hange (D)irectory - command. To achieve this the command 'SET DEFAULT TO <x>' was - and still is - used. The foxpro results of e.g. 'SET DEFAULT TO F:Test' are:
It seems that Foxpro doesn't store the full path like VO does.
In the already posted VFPSysAndDir.viaef i modified the foxpro dialect behaviour of the X# functions curDir() and curdrive(). So the X# results would be the same.
A modified X# SetDefault() function might look like:
Note: Similar to the Foxpro dir commands the SET DEFAULT command throws a exception if a dir selection fails.
The question is: if the Foxpro dialect is used, what should a SetDefault("F:Test") do ? Store the given path or the drive name ?
regards
Karl-Heinz
it´s no final solution, i just collected what i've noticed so far ...
In the early Foxpro days there's been no CD - (C)hange (D)irectory - command. To achieve this the command 'SET DEFAULT TO <x>' was - and still is - used. The foxpro results of e.g. 'SET DEFAULT TO F:Test' are:
Code: Select all
? Set ( "Default" ) -> "F:" - same as Sys(5)
? Curdir() -> "TEST"
Code: Select all
SetDefault(F:Test)
? GetDefault() -> F:Test
Code: Select all
? CurDrive() , Sys(5) // "F:" "F:"
? curdir() // "TEST"
Code: Select all
FUNCTION SetDefault(cPathSpec AS STRING) AS STRING
SetPathArray(NULL)
IF XSharp.RuntimeState.Dialect == XSharpDialect.FoxPro
TRY
XSharp.IO.File.ClearErrorState()
Directory.SetCurrentDirectory(cPathSpec)
cPathSpec := CurDrive() // this would save the drive name only , e.g. "F:"
CATCH e AS Exception
XSharp.IO.File.SetErrorState(e)
END TRY
IF RuntimeState.FileException != NULL
THROW RuntimeState.FileException
ENDIF
ENDIF
SETSTATE STRING Set.Default cPathSpec
The question is: if the Foxpro dialect is used, what should a SetDefault("F:Test") do ? Store the given path or the drive name ?
regards
Karl-Heinz