Skip to main content
Paul1
Senior III
July 15, 2022
Question

[resolved] Rename/Checkout STM32 Project to different folder

  • July 15, 2022
  • 5 replies
  • 2487 views

Sometimes I end up working on multiple branches of a project (ain't life fun!).

With STM32CubeIDE it seems if I rename the project folder

Project

Project_Main

Project_BranchX

Then the Sources paths defined in the project are broken/lost, and any excludes in those sources folders are lost (The sources folders in project tree are empty).

Is there a way to define custom sources folders such that they aren't lost/broken if project folder is renamed? (i.e. relative paths or similar)

Using: Win10, STM32CubeIDEv1.10.1

Paul

This topic has been closed for replies.

5 replies

MM..1
Chief III
July 15, 2022

I use this steps , but in one workspace you an have only one named project .

  1. In IDE delete project from workspace (no files)
  2. In file manager rename top folder for project
  3. iDouble click .project file
Paul1
Paul1Author
Senior III
July 15, 2022

I didn't describe it well.

So our Git has many STM32CubeIDE projects in a folder, as well as several folders of shared files (libs)

git_folder

  • project1
  • project2
  • project3
  • sharedA
  • sharedB

When add files in shares to projects using Source/Include/exclude, the path to the shares is absolute, not relative. If I rename git_folder, or check out to a slightly different named folder (git_folder2), then the shares in the projects fail since the absolute path no longer works.

I guess a bit issue is how we handle the shares. We haven't built these into true libraries because they are in early development and being constantly added to and debugged.

Any suggestions on how to handle the shares?

  • Is there a way to put a relative path in project sources (project\..\sharedB)?
  • something completely different?
  • There are actually about a dozen projects and half dozen shares, and growing. Many custom interconnected PCBs.

Using: Win10, STM32CubeIDEv1.10.1B

Paul

Pavel A.
Super User
July 15, 2022

When you rename a containing folder of a project but not the project itself, then obviously all things like ${workspace_loc:/${ProjName}/...} become invalid.

Same if you change the project name but not the folder.

In these cases try to change ${workspace_loc} to ${ProjDirPath}. ${ProjDirPath} is always the correct directory path of the project..

MM..1
Chief III
July 15, 2022

For sharing maybe not use exclude and different project folder, but add shared as MKLINK folder under project, that use it. Link name cant change , but linked folder yes.

Advantage is no exclude required.

Paul1
Paul1Author
Senior III
July 18, 2022

Guess I was just having a strange week last week.

Nice fresh Monday, and a simple ..\ works as expected to create a relative path.

In sources I select the path to ShareA, then replace its long absolute path with ..\ and it works, even when copy/rename repository.

  • Absolute Share: D:\data\git\repo5\__code\ShareA
  • Relative Path: ..\LibST
  • For Project: D:\data\git\repo5\__code\Project1

  • Project > RightClick:Properties > C/C++ General> Paths and Symbols > Source Location:
  • Link Folder… > [+] Link to Folder in the file system > Browse > ..\LibST     (Outside Project)

(FYI: right click properties > source path = shows as ${PARENT-1-PROJECT_LOC}\ShareA)

Happy Monday !?!?

Paul