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

How to change the default external input file location within xcode

D_H__Kim
Beginner
1,167 Views
I believe this is a very basic stuff. I spent a fair amount of time searching for the answer in the forum and in the reference guide. But I couldn't find the solution. So let me ask here.

I don't have any problem with the source code that includes the following line as long as 'input.txt' is placed in the same folder when I compile the source code via the command line mode.
OPEN(3,FILE='input.txt',STATUS='OLD')
But when I compile it within Xcode, the executable does search for 'input.txt' in a different folder (i.e., /Users/daehyun).
I know I can set an absolute directory or I can change the location by 'export FOR_READ= ...'.
But I want the executable to find the input file in the same folder (just like the case when I compiled it via the command line mode). How can I achieve this?
Thanks in advance,
Daehyun
0 Kudos
3 Replies
Kevin_D_Intel
Employee
1,167 Views

Users can control the working directory under Xcode for a specific executable as follows:

Under Groups & Files, expand the Executables group (this is different from Target) by left double-clicking on Executables. Right-click on the executable name of interest and select Get info. The Working directory selections available appear on the General tab.

The working directory is set to the Build Products directory by default. There are other selections for the Project directory or Custom directory. You can choose Custom Directory and then set the value to the directory containing the input files and reference input files by name in OPEN statements as you described you wish to.

Keep in mind the program uses this working directory during execution and it may be polluted with other files the program creates. To avoid that, set this to another custom scratch directory (relative to the Project directory) used strictly for execution and then modify the OPEN statements to use a relative path like: ..// making sure to also place a copy of the input files into the scratch directory.

Hope that helps.

0 Kudos
D_H__Kim
Beginner
1,167 Views
Thanks a lot, Kevin.

Let me spend sometime playing around with different options including your suggestion about the separate relative scratch directory. Have a good day! -Daehyun
0 Kudos
Kevin_D_Intel
Employee
1,167 Views
Not sure what might be controlling this then. Keep us posted on what you find.
0 Kudos
Reply