cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Advisor
Advisor
9,529 Views
Registered: ‎10-10-2014

Vivado - automatically set working directory to the current (opened) project directory

Whenever I open a project via the Vivado IDE (2015.4) , the 'working directory' is set to C:/Users/MyName/AppData/Roaming/Xilinx/Vivado (using the tcl command 'pwd')

 

Can this working directory be changed automatically to the open project directory? Is there some IDE option for this? I.e. the location of the .xpr file? For example .jou files are written to this location etc.

 

However when executing for example write_project_tcl, it writes the file to C:/Users/MyName/AppData/Roaming/Xilinx/Vivado, which is not what you want. And it's quiet annoying to change it each through the tcl window...

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
6 Replies
Highlighted
Moderator
Moderator
9,526 Views
Registered: ‎01-16-2013

@ronnywebers,

 

 

Some ways of changing the CWD to the current project directory are listed below:

    • Invoke Vivado tools from command line while in the project directory .
    • Double-click on the .xpr project file in Windows Explorer. This will open the project in Vivado IDE and the project directory will be used as the working directory.
    • A command to CD to the current project directory could be added as a proc in the init.tcl file.
      • Example: after adding the following proc to the init.tcl, a user can type cdp from the Tcl console to change the CWD to the project t to the current working directory.
        proc cdp { } {
        cd [get_property DIRECTORY [current_project]]
        }
      • One user suggests creating a button (Tools > Custom Commands) to generate report files.
# SETS THE WORKING DIRECTORY TO THE PROJECT SO THAT IF YOU GENERATE FILES THEY ARE WRITEN TO THE DIR
set work_directory [get_property DIRECTORY [current_project]] ; cd $work_directory ; puts -nonewline "Changing Directory to " ; pwd

See also (Xilinx Answer 55459)

 

--Syed

---------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

Did you check our new quick reference timing closure guide (UG1292)?
---------------------------------------------------------------------------------------------
Highlighted
Xilinx Employee
Xilinx Employee
9,518 Views
Registered: ‎07-31-2012

This can be done from Vivado GUI as shown below.This can be accessed from Tools-> Options

 

delete.PNG

 

 

Thanks,
Anirudh

PS: Please MARK this as an answer in case it helped resolve your query.Give kudos in case the post guided you to a solution.
Highlighted
Advisor
Advisor
9,503 Views
Registered: ‎10-10-2014

thanks @athandr, I think that is what I'm looking for - didn't know about these options. 

 

However, I would expect that 'last project's directory' would mean just this ... or that there would be an option like 'current project directory'.

 

I asume if I go for 'specify project directory', I still need to adjust this when I switch from project A to project B ...?

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
Highlighted
Moderator
Moderator
8,737 Views
Registered: ‎01-16-2013

@ronnywebers

 

For 'specify project directory' The setting will be stored and it will remain same for the directory specified. 

 

From UG893:

Default Project Directory: Specifies where the Vivado IDE searches for existing projects, and where it writes newly created projects.

 

--Syed

---------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

Did you check our new quick reference timing closure guide (UG1292)?
---------------------------------------------------------------------------------------------
0 Kudos
Highlighted
1,184 Views
Registered: ‎01-12-2020

You can change the start location in the properties in the short cut link.

viva.png

0 Kudos
Highlighted
Newbie
Newbie
1,029 Views
Registered: ‎08-08-2019

It looks like these solutions only work for the invocation of Vivado and only for a one project.  If you are working on multiple projects (Who isn't?) your out of luck. If you change projects from within Vivado, the working directory stays pointing to the old project.  Also if you are in a source code controlled environment they don't work unless everyone has the exact same directory structure.  That is particularily difficult when some use linux and some use windows as the directory structures are inherently different.  I use both often for the same project.

I added a tcl script file containing:  cd [get_property DIRECTORY [current_project]] to all my project directories. I also drop the script into other directories that might become a Vivado startup directory.

As long as I, somehow, get the cwd to point to the current project directory some time before I change projects, I can source that script (which will taken from the old directory) after I change to the new project.  Quite a PIA, especially given how easy it would be for the tool to do this automatically!

 

0 Kudos