[SOLVED] How to obtain the Project name ?
There is the macro __FILE__ to know the complete path of the source code but how to estract only the project name of CubeWorkspace ?
I would like to display this on my develop phase to be sure of the version running.
On Arduino Due I have used this code but with STM32 is not easy:
void display_Running_Sketch (void)
{
String the_path = __FILE__;
String the_date = __DATE__;
String the_time = __TIME__;
String ver;
int slash_loc = the_path.lastIndexOf('\\');
String the_cpp_name = the_path.substring(slash_loc+1);
int dot_loc = the_cpp_name.lastIndexOf('.');
String the_sketchname = the_cpp_name.substring(0, dot_loc);
ver = the_sketchname + " " + the_date + " " + the_time;
myGLCD.setFont((unsigned char *)SmallFont);
myGLCD.setColor(255, 255, 255);
myGLCD.print((const char *)ver.c_str(), CENTER, 1);
delay(1000);
myGLCD.print((char *)" ", CENTER, 1);
}