Difference between revisions of "Automatic source paths"

From Code::Blocks
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
 
* '''Edit''': Edit current selected path from the list
 
* '''Edit''': Edit current selected path from the list
 
Adding or Editing a path opens the ''Edit path dialog''
 
Adding or Editing a path opens the ''Edit path dialog''
[[File:Globs ui 2.png|thumb|alt=|center]]
+
[[File:Globs ui 2 2.png|alt=|center|thumb]]
 
# The path to automatically overwatch
 
# The path to automatically overwatch
 
# Open the system path dialog to select the path to automatically overwatch
 
# Open the system path dialog to select the path to automatically overwatch
Line 21: Line 21:
 
# If this is checked all sub folder of this path are also overwatched
 
# If this is checked all sub folder of this path are also overwatched
 
# A list of wildchards separated by ';' for file extension that are imported for this glob (ex. ''*.h'' to import only header files, ''*.cpp;*.h'' to import cpp and h files
 
# A list of wildchards separated by ';' for file extension that are imported for this glob (ex. ''*.h'' to import only header files, ''*.cpp;*.h'' to import cpp and h files
 +
# Select targets where the files found in Path are added
 +
# Checkbox to select all/none targets
 +
# When this box is checked files will be added to the project file. The project file will be modified every time a file is found. This allows to change properties of the file (like target, or linker flags). The properties are saved in the project file and reloaded when the project is reloaded. If this box is left unchecked the files are loaded when codeblocks is running, but not saved to project file. With this unchecked file properties can not be saved and will be lost.
  
 
== Example ==
 
== Example ==
Line 26: Line 29:
 
[[File:Directory 1.png|thumb|center]]
 
[[File:Directory 1.png|thumb|center]]
 
Lets assume that files in ''src'' are added/removed automatically by a third party software. Adding now an ''automatic source folder'' in codeblocks will automatically add/remove files if they are changed on the file system.
 
Lets assume that files in ''src'' are added/removed automatically by a third party software. Adding now an ''automatic source folder'' in codeblocks will automatically add/remove files if they are changed on the file system.
[[File:Edit glob example.png|thumb|center]]
 
 
[[File:Edit glob example 2.png|thumb|center]]
 
[[File:Edit glob example 2.png|thumb|center]]

Latest revision as of 22:30, 21 February 2023

Introduction

Automatic source paths is a feature of codeblocks to automatically mirror folders from the source directory to the codeblocks project file. A use case is for example if a external program creates source files that are used in codeblocks. With automatic source paths codeblocks automatically detects changes (addition and removal of source files) in the given directory and mirrors them to the project file.

UI

The functionality can be accessed over the Project->Automatic source folders menu entry:

Globs menu.png

This opens the overview dialog

Globs ui 1.png
  • Path: The base path in which files are searched for automatic import
  • Recursive: Search also in sub folders
  • Wildcard: Filter files according this wildcard (for example *.cpp: import only files ending with .cpp
  • Add: Add an new path
  • Delete: Delete current selected path from the list
  • Edit: Edit current selected path from the list

Adding or Editing a path opens the Edit path dialog

  1. The path to automatically overwatch
  2. Open the system path dialog to select the path to automatically overwatch
  3. Open the global variables dialog to select a global variable that is replaced and overwatched by codeblocks
  4. If this is checked all sub folder of this path are also overwatched
  5. A list of wildchards separated by ';' for file extension that are imported for this glob (ex. *.h to import only header files, *.cpp;*.h to import cpp and h files
  6. Select targets where the files found in Path are added
  7. Checkbox to select all/none targets
  8. When this box is checked files will be added to the project file. The project file will be modified every time a file is found. This allows to change properties of the file (like target, or linker flags). The properties are saved in the project file and reloaded when the project is reloaded. If this box is left unchecked the files are loaded when codeblocks is running, but not saved to project file. With this unchecked file properties can not be saved and will be lost.

Example

In this example we use the following folder structure:

Directory 1.png

Lets assume that files in src are added/removed automatically by a third party software. Adding now an automatic source folder in codeblocks will automatically add/remove files if they are changed on the file system.

Edit glob example 2.png