>>Is there a good way to soft code the path to the data that will be read by a COM DLL? I have tried several variations of SYS(2004) and HOME() all to no avail. My latest attempt was:
>>
>>
>>this.cDataPath = sys(2004) + "data\"
>>set path to (this.cDataPath)
>>set default to (this.cDataPath)
>>
>>
>>This worked OK on the first call to the server but fails on subsequent calls with an error message to the effect that the dbf does not exist. At the same time it seems to be looking for the file in the windows system directory rather than the location specified. This second call to the COM server is based on a freshly loaded instance of the COM object so I can't figure out why or how the path is getting screwed up. Everything works fine if I hard code the location but then I have to maintain different versions for the development PC and the ultimate web server.
>>
>>Any insights on whats going on will be appreciated.
>>
>>- Don
>
>This is what I use to cover all the bases:
>
>
>If Application.StartMode = 0 Then
> If Type("Application.ActiveProject") = [O] Then
> Application.DefaultFilePath = Application.ActiveProject.HomeDir
> Else
> Application.DefaultFilePath = Justpath(Substr(Sys(16),At([\],Sys(16))-Iif(At([\\],Sys(16))=0,2,1)))
> Endif
>Else
> Application.DefaultFilePath = Justpath(Application.ServerName)
>Endif
>
>
>Carlos
THanks Carlos
For some reason unknown to me I was not able to get Justpath(Application.ServerName)to work reliably for me. Sometimes it would return the proper value and other times it would not. Probably somethig quirky in my code. Sergey's solution seems to work OK, at least for the moment.