How can I set or reset the path that I want a function to work in.
In my program I have my user load a file. I take a copy of that file and place it where my application is. I then explicitly do a filexist of the copied file. Then I explicitly retrievefile() from the copied file. However,
the retrievefile accesses the original file and not the copied file. Uggggh!!!!
Here is a piece of my code:
Sub LoadProgram
'Saves what it already has
#break# EmbedClean
Progname=GetProgram
XVPLOAD_g =1
'Load.File
#break# if FileExist(AppPath&"\"&Progname) then
LoadTables(AppPath&"\"&Progname,"prog")
End If
SaveTables
WOSetupData
End Sub
Sub GetProgram
Load.Filter = "*.xvp|*.xvp"
'DefFile_g= "datap.xvd"
if Load.Show = cCancel then
return
else
'Move the file to where the program is
FileCopy(Load.File,FileName(Load.File))
'possibly save the old .xvv
'check and see if their is an accompanying .xvd - if so load the .xvd
Return FileName(Load.File)
end if
End Sub
Sub LoadTables(EMBEDfile,fname)
ErrorLabel (errHandler)
atemp =fname&".xva.txt"
ptemp=fname&".xvv.txt"
dtemp=fname&".xvd.txt"
TheVFile= PFile_g
if FileExist (EMBEDfile) then
FileOpen(d2,EMBEDfile,cRandom)
Xemb.New1(d2,true)
'This is not the first Run and everything should be setup.
'User must setup before user can load and .XVP
FIRSTRUN_g = 0
'Unembed Files
'VISION/PROGRAM DATAFILE
'Load Up Table with Data files
Xemb.RetrieveFile(TheVFile)
if FileExist(TheVFile) then
'Clear the old vision table
RemoveVisTable
'Unencrypt files with key
DecryptFile (TheVFile,ptemp)
USERTABLEP.LoadCSV(ptemp,delim, True,True)
FileDel(ptemp)
...
In my program I have my user load a file. I take a copy of that file and place it where my application is. I then explicitly do a filexist of the copied file. Then I explicitly retrievefile() from the copied file. However,
the retrievefile accesses the original file and not the copied file. Uggggh!!!!
Here is a piece of my code:
Sub LoadProgram
'Saves what it already has
#break# EmbedClean
Progname=GetProgram
XVPLOAD_g =1
'Load.File
#break# if FileExist(AppPath&"\"&Progname) then
LoadTables(AppPath&"\"&Progname,"prog")
End If
SaveTables
WOSetupData
End Sub
Sub GetProgram
Load.Filter = "*.xvp|*.xvp"
'DefFile_g= "datap.xvd"
if Load.Show = cCancel then
return
else
'Move the file to where the program is
FileCopy(Load.File,FileName(Load.File))
'possibly save the old .xvv
'check and see if their is an accompanying .xvd - if so load the .xvd
Return FileName(Load.File)
end if
End Sub
Sub LoadTables(EMBEDfile,fname)
ErrorLabel (errHandler)
atemp =fname&".xva.txt"
ptemp=fname&".xvv.txt"
dtemp=fname&".xvd.txt"
TheVFile= PFile_g
if FileExist (EMBEDfile) then
FileOpen(d2,EMBEDfile,cRandom)
Xemb.New1(d2,true)
'This is not the first Run and everything should be setup.
'User must setup before user can load and .XVP
FIRSTRUN_g = 0
'Unembed Files
'VISION/PROGRAM DATAFILE
'Load Up Table with Data files
Xemb.RetrieveFile(TheVFile)
if FileExist(TheVFile) then
'Clear the old vision table
RemoveVisTable
'Unencrypt files with key
DecryptFile (TheVFile,ptemp)
USERTABLEP.LoadCSV(ptemp,delim, True,True)
FileDel(ptemp)
...