>
> Does anyone know how to determine the UNC path
> in a FoxPro 2.6 program? I have users attached to the
> server using different path letters and I want to set the server path
> letter dynamically in the program and I
> haven't been able to figure out how.
>
> Example: User A wants files on drive R:
> User B wants same files but computer points to Drive M:
>
> How do I get the program to figure out the drive letter?
>
Hi Sarah,
here's one trick we solved this situation. We use small ascii-text file
called "whatever.ini" and in startup of application it looks in its
default directory for this file. Then it opens this file with fopen and
reads line after line with fgets. Every line is assigned to a array and
then we set what we need. It ends reading when it encounters "*".For
example I use this to set the default path, the path to data, some
global variables, etc.
Here's some code...
.
wait wind 'One moment please, setting an environment...' nowait
.
myerror = .f.
nextline = .t.
handler = fopen('konvert.ini')
if handler >= 0
i=0
do while nextline = .t.
line = fgets ( handler )
if line <> '*'
i = i + 1
dimen r [i]
r[i] = line
else
nextline = .f.
endif
enddo
AktDisk = r[1]
def_cesta = AktDisk + r[2]
ProgPath = AktDisk + r[3]
DataPath = AktDisk + r[4]
PamFile = r[5]
OutPath = ProgPath + r[6]
set defa to &ProgPath
set path to &DataPath
else
wait wind ' Program "name of program" : Error !!!' + chr(13) +
'Can't set up environment...'
= fclose ( handler )
myerror = .t.
return to *mainprogram
endif
= fclose ( handler )
.
. after return mainprogram checks if myerror is .t. or .f. and goes
on....
.
hth
Happy New Year!!!!!
Dezider
--
There were three worst disasters in the history of human
race in 20-th century:
1, Hiroshima 44
2, Tchernobyl 86
3, Windows 95