Subject: | Re: SetDir()
| Date: | 16 Apr 2021 11:27:45 -0400
| From: | "Kevin Zawicki" <numberjack@wi.rr.com>
| Newsgroups: | pnews.paradox-programming
|
I am not sure what you are trying to do?
#2 the :PRIV: need quotes around it?
#3 is that just an example, you are actually looking for file1
what are you trying to set the filesystem dir to?
this looks like you are:
getting the filesystem dir
setting filesystem dir to the PRIV alias path
doing a find first
then setting filesystem dir back to what you started with
here are some samples, maybe it will help?
method run(var eventInfo Event)
var
fs filesystem
currDir string
aDir string
endvar
;// I think filesystem opens with no current directory?
view(
fs.getdir()
)
currDir = fs.getdir()
currDir.view()
aDir = getAliasPath("PRIV")
aDir.view()
;//assumes a slash if wanted ;assumes not blank and is >1 size simple
example
if aDir.substr(aDir.size(),1) <> "\\" then
aDir = aDir + "\\"
endif
aDir.view()
fs.setDir(aDir)
view
(
fs.getDir() ;shows a slash
)
fs.setDir("C:\\temp") ;I think the setDir path must exist, create a
C:\temp to test
view
(
fs.getDir() ;shows \temp
)
{
also look at set drive
Sets a specified drive as the default drive.
setDrive ( const name String ) Logical
Description
setDrive sets the specified drive as the default. The method returns True
if successful; otherwise, it returns False. You can specify the drive with
a letter (C), a letter and a colon (C:), or an alias (for example: :MAST:).
Note you can refence a full path in most filesystem commands I think
example
fs.delete("C:\\temp\\file1.txt")
}
endMethod
Peter <peterspammenot@whiteknight.email> wrote:
>var
> fsy filesystem
> strCurrentDirectory string
>endvar
>
>1) strCurrentDirectory = fsy.getDir()
>2) fsy. SetDir(:PRIV:)
>3) fsy.findFirst("file1")
>4) fsy.SetDir(strCurrentDirectory) ;//doesn't work
>
>#4 doesn't work because getdir() returns the string with single "\"
>
>So what I wuld like to do is capture the current alias. How do I do
>that? Thank you for any help.
>
>
>Peter
|