Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

paths for source files in project'folder

luissolis
Beginner
465 Views
I'musingvisual fortran 6.6 c on windows 2000
I'm writing a script to backup up my fortran sourcefiles in a project. When a sorce file (*,f90,*.for,..)is not in the project's folder i dont know where i could found this information. I open the text files in the project (*.mak and *.dsp)and i found all the sources names, but not the paths.
Thanks in advance
Luis
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
465 Views
Look closer -- sourcefile pathsare within .dsp file, following SOURCE= clause e.g:
SOURCE=..SourceDTPicker.f90
however, the path is obviously relative to the location of .dsp file itself. It's not too dificult to "merge" them though. (I'm just looking at a freeware source code of a Visual Studio add-in which does just that, and I can point you to it if you wish, but it seems easier to roll your own than to look at it as it's written in C++). Also, it states (sigh):
/**
Since Visual Studio provides no COM method of returning the names of
files in a project, we have to cheat, and read them from the .DSP
files on disk. This has at least one primary disadvantage. If a
change is made to the project in the Developer Studio, the project
MUST be saved before we can process the change here.
**/
Jugoslav
0 Kudos
luissolis
Beginner
465 Views

mi folder hyerarchy is something like this:

c:fordevgeneral_code (in this folder are things like spline.f90, sort.f90, zeros.f90....

c:fordevproject1 (in this folder are specific source files).

The project includes the source files in "." folder's projectbut also source files from generalcode "....". I cannot readthe name of this path.

Luis

0 Kudos
Jugoslav_Dujic
Valued Contributor II
465 Views
My point is, once you know thatthe relative path is "....something",you can reconstruct the absolute path yourself.
There are APIs like PathCanonicalize and PathCombine (shlwapi.dll) which should let you do that, however, I don't see appropriate INTERFACE blocks for them in CVF INCLUDE folder. Here's some ad-hoc Fortran code which will let you do that:
character(260) sAbsPath
sDspPath = "c:fordevproject1"
sFilePath = "....generalcode"
iFileStart = index(sFilePath, "..")
iCommonEnd = len_trim(sDspPath)
do while (iFileStart .ne. 0)
!Go "up" one backslash in sDspPath for every ".."
!encountered in sFilePath
iCommonEnd = index(sDspPath(1:iCommonEnd-1), "", .TRUE.)
!Remove leading ".." from sFilePath
sFilePath = sFilePath(4:)
iFileStart = index(sFilePath, "..")
end do
sAbsPath = sDspPath(1:iCommonEnd) // sFilePath
Jugoslav
0 Kudos
Reply