BUG: FULLPATH() Does Not Work Correctly in FoxPro for UNIX

ID: Q124780

The information in this article applies to:

SYMPTOMS

The FULLPATH() function does not return the correct relative paths.

WORKAROUND

Do not pass the reference to a parent directory by using ../ or ..\ in the path of the file passed to the FULLPATH() function. See the example in the "Steps to Reproduce Problem" section in this article.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Because the FULLPATH() function is not returning the correct value, the screen code generator will not generate the right code for opening databases and indexes, in some cases. To ensure that the code is generated correctly, follow these steps:

1. Type the following command in the Command window:

   MODIFY COMMAND //usr/lib/FoxPro/genscrn.prg

2. Choose Find from the Edit menu, and type the following in the "Look
   For:" box:

   FUNCTION findrelpath

3. Choose the Find button.

4. Press the DOWN arrow key to scroll down approximately five lines to

   place the cursor on the following line:

   PRIVATE m.fullpath, m.relpath

5. Add the following lines of code below the current line:

   IF LEFT(m.name,3)='..\' OR LEFT(m.name,3)='../'
      m.name=SUBSTR(m.name,4)
   ENDIF

6. Choose Save from the File menu.

7. Choose Close from the File menu.

8. Type the following command in the Command window:

   COMPILE //usr/lib/FoxPro/genscrn.prg

Steps to Reproduce Problem

In the FoxPro Command window, type the following commands:

   SET DEFAULT TO //usr/lib/FoxPro/sample
   ? FULLPATH('../dbfs/clients.dbf', ;
              '//usr/lib/FoxPro/sample/screens/clients.scx')

The result printed to the screen is this:

   C:\USR\LIB\FOXPRO\SAMPLE\..\DBFS\CLIENTS.DBF

The result should be:

   C:\USR\LIB\FOXPRO\SAMPLE\DBFS\CLIENTS.DBF

To obtain the correct result, use the following command:

   ? FULLPATH('dbfs/clients.dbf', ;
              '//usr/lib/FoxPro/sample/screens/clients.scx')

Additional reference words: FoxUnix 2.60 buglist2.60 KBCategory: kbtool kbbuglist KBSubcategory: FxtoolSbuilder

Last Reviewed: January 12, 1995