Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi for PHP/IDE/Other    [ Add a report in this area ]  
Report #:  79097   Status: Reported
Relative path not formed correctly when adding a USES file
Project:  HTML5 Builder Build #:  2.1.0.1098
Version:    2.0 Submitted By:   John Mackerras
Report Type:  Basic functionality failure Date Reported:  10/29/2009 11:48:54 AM
Severity:    Commonly encountered problem Last Updated:
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 1
Description
When using the "Use Unit" menu item to add in a required use file, and that use-file is located in a higher directory than the directory using the file, the relative path is incorrectly formed.

By example, if the path to my use-file includes the step-down (../) command, you would normally add in the line  

  require_once("../use.php");

If I choose "Use Unit" from the File menu of Delphi for PHP, the file is identifed in the chooce box as "../use.php" yet an additional step-down command is added into the path such "../../use.php" and the require line is shown

  require_once("../../use.php");


The require_once line must then be manually edited so that the correct number of step-downs is in the file path.
Steps to Reproduce:
Re-create steps

1. Create a new project in D4PHP.

2. Save a PHP file in the main project directory, called "datamodule.php"

3. Create a sub-directory inside the main project directory and call this directory "SubDir".

4. Save a PHP file in the newly created "SubDir" directory and call it "main.php"

5. While working in main.php, choose "Use Unit" from the file menu. A selection box will pop up and will contain one item. This item will be "../datamodule.php". Double-click on this file and Delphi for PHP will add in a require_once line into sub.php.

6 Examine the newly added require_once line. It will look like this.
    require_once("../../datamodule.php");
    
  but should look like this  
    require_once("../datamodule.php");
    
  as the file we require is only one directory below the focussed directory.

Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01