-Git version integrated into code

main
Harry van Haaren 2013-11-14 17:32:51 +00:00
parent ff462b06fe
commit 10f6256330
6 changed files with 42 additions and 7 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ buildTest/*
/src/Makefile /src/Makefile
CMakeFiles/* CMakeFiles/*
src/CMakeFiles/* src/CMakeFiles/*
/src/version.hxx

View File

@ -1,3 +1,4 @@
#!/bin/bash
./version.sh
git archive HEAD --format=zip > lupppGit_`date +"%m-%d-%Y"`_`git log --pretty=format:"%h" | head -n1`.zip git archive HEAD --format=zip > lupppGit_`date +"%d-%m-%Y"`_`git log --pretty=format:"%h" | head -n1`.zip

View File

@ -218,13 +218,36 @@ int DiskWriter::writeControllerFile(std::string name ,
if ( infile.good() ) if ( infile.good() )
{ {
// file exists: ask user overwrite or rename? // file exists: ask user overwrite or rename?
LUPPP_WARN("Controller filename exists: prompting user to overwrite y/n?"); //LUPPP_WARN("Controller filename exists: prompting user to overwrite y/n?");
int overwrite = fl_choice("Controller filename exists, overwrite?", "no", "yes", 0); int action = fl_choice("Controller exists, action?", "Cancel", "Rename", "Overwrite");
if ( !overwrite ) if ( action == 0 )
{ {
// return OK, as user has chosen to *not* write the file // return OK, as user has chosen to cancel writing the file
return LUPPP_RETURN_OK; return LUPPP_RETURN_OK;
} }
else if ( action == 1 )
{
// rename here
const char* name = fl_input("New name for .ctlr file:");
if ( name )
{
// clear the filename
controllerCfgPath.str( "" );
controllerCfgPath << getenv("HOME") << "/.config/openAV/luppp/controllers/" << name << ".ctlr";
LUPPP_NOTE( "New .ctlr filename %s", controllerCfgPath.str().c_str() );
}
else
{
LUPPP_NOTE("No name entered for .ctlr file, canceling!");
return LUPPP_RETURN_ERROR;
}
}
else
{
// just overwrite the file, no action
}
} }
LUPPP_NOTE("Writing .ctlr file to disk"); LUPPP_NOTE("Writing .ctlr file to disk");

View File

@ -1,5 +1,6 @@
#include "config.hxx" #include "config.hxx"
#include "version.hxx"
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
@ -32,6 +33,8 @@ void signalHanlder(int signum)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
LUPPP_NOTE("%s", GIT_VERSION );
bool runTests = false; bool runTests = false;
bool stopAfterTest = false; bool stopAfterTest = false;
if(runTests == stopAfterTest){} // warning if(runTests == stopAfterTest){} // warning

View File

@ -18,7 +18,7 @@ MidiIO::~MidiIO()
{ {
jack->unregisterMidiIO( this ); jack->unregisterMidiIO( this );
LUPPP_NOTE("~MidiIO unregistring ports"); //LUPPP_NOTE("~MidiIO unregistring ports");
jack_port_unregister( jack->getJackClientPointer(), jackInputPort ); jack_port_unregister( jack->getJackClientPointer(), jackInputPort );
jack_port_unregister( jack->getJackClientPointer(), jackOutputPort ); jack_port_unregister( jack->getJackClientPointer(), jackOutputPort );
} }

7
version.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# this file writes src/version.h from the git commit
echo "
#ifndef GIT_VERSION
#define GIT_VERSION \"`date +\"%d-%m-%Y\"` `git log --pretty=format:"%h" | head -n1`\"
#endif" > src/version.hxx