DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0028673

getsourcefile Draw command return different output on Linux and Windows platforms

Open CASCADEOCCT:Foundation Classesclosed15 public notes

Search issues

Description

Windows :
> getsourcefile pload
src/Draw/Draw_PloadCommands.cxx

Linux :
> getsourcefile pload
/src/Draw/Draw_PloadCommands.cxx

Steps to reproduce

test :
demo draw getsource

Public activity

15 archived notes

Participants are labeled by their role within this record.

01Commenter 1
The cause of different path computation is the way how compiler computes the path of the current compilation unit (when the macro __FILE__ is used).
For example, under VC10 it returns the file path starting with "../../../src", while under VC12 it returns the full path starting with "D:\".
02Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: msv
Date: Fri Apr 21 17:18:14 2017 +0300

    0028673: getsourcefile Draw command return different output on Linux and Windows platforms
    
    The method OSD_Path::RemoveATrek has been modified, so that to remove leading track separator if the first component has been removed.
    Now the command getsourcefile returns the relative path starting with "src" without leading "/" on all platforms.
03Commenter 3
Dear Kirill, please review.
04Commenter 4
I believe that making punctual changes in OSD_Path without clear understanding how it should behave is not worth doing: it can easily cause regressions in existing client's code but does not solve the issue completely, as its reason is lack of clear behavior. This is to be done together with other related issues.
05Commenter 5
I can propose another, more safe way. It is to add a new method in OSD_Path with name RemoveLeadingTrekSeparator(). It will remove the leading separator if any from the track. Then call this method from Draw_Interpretor::add().
What is your opinion?
06Commenter 6
At last, the most safe way we found is to make needed correction in the method Draw_Interpretor::add().
07Commenter 7
I prefer not to add new methods until we get clear idea how this class should work in all cases and define reasonable interface
08Commenter 1
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: msv
Date: Fri Apr 21 17:18:14 2017 +0300

    0028673: getsourcefile Draw command return different output on Linux and Windows platforms
    
    The method Draw_Interpretor::add() has been corrected so that the command getsourcefile returned the relative path starting with "src" without leading "/" on all platforms.
09Commenter 9
Please review the new version.
10Commenter 10
No remarks, please test (only test demo draw getsource needs to be checked, on both Linux and Windows).

11Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
12Commenter 12
Dear Author,
Branch CR28673_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]

Testing cases:
http://occt-tests/CR28673_1-master-OCCT/Debian70-64/demo/draw/getsource.html
http://occt-tests/CR28673_1-master-OCCT/Windows-64-VC10/demo/draw/getsource.html
demo draw getsource: OK
13Commenter 13
Dear Author,
Branch CR28673_1 is TESTED.
14Commenter 1
Branch [archived branch] has been deleted by Commenter 2.

[revision removed]
15Commenter 1
Branch [archived branch] has been deleted by Commenter 2.

[revision removed]