General information
Category:
Coding, syntax & commands
The following code is involved in an application I'm trying to distribute, but it is behaving differently depending on where it is run from. I can't understand why.
Assume a directory structure like this:
C:
\DIR1
\DIR2
\FIRST
\BASE
The program is run from a directory (C:\DIR1) containing a .DBF called 'filloc' in it. The contents of the 'data' field contain a path (for this example, 'C:\DIR2\FIRST\'). The commands are then simply to go up one level (to DIR2) and then down into the sub-directory BASE where the program will contiue.
I put in the 'test' window for debugging and that's when the odd behavior really began.
Here are 3 scenarios:
1) If I run the program from within VFP, it executes perfectly.
2) If I create an executable and put it in C:\DIR1 and run it, the messages that show up in the test window are all the same: 'C:\DIR2\FIRST'. For some reason, the 'CD ..' command has no effect in this case. I get an 'Invalid path or filename' error after the second message because the program is trying to change to 'BASE' directly from 'FIRST'.
3) If I put the executable in a separate directory on another drive with the line 'SCREEN = OFF' in the CONFIG.FPW file, it doesn't show the 'test' window at all, but it runs fine.
Any help with this would be greatly appreciated as it has me completely baffled.
TIA,
Rob
Here's the code:
DEFINE WINDOW test;
FROM 20,40 TO 30,100;
IN DESKTOP;
TITLE 'Current Directory'
ACTIVATE WINDOW test
USE filloc
m.home=RTRIM(filloc.data)
SET DEFAULT TO (m.home)
? FULLPATH(CURDIR())
WAIT '' TIMEOUT 1
CD ..
? FULLPATH(CURDIR())
WAIT '' TIMEOUT 1
CD base
? FULLPATH(CURDIR())
WAIT '' TIMEOUT 1
RELEASE WINDOW test
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only