Awful master
authorCameron Ball <c.ball1729@gmail.com>
Thu, 2 Apr 2015 22:25:41 +0000 (06:25 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Thu, 2 Apr 2015 22:25:41 +0000 (06:25 +0800)
src/GameState.cpp
src/ScreenEvaluation.cpp

index e1e075f..9dd73bf 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <ctime>
 #include <set>
-
+#include <unistd.h>
 
 GameState*     GAMESTATE = NULL;       // global and accessable from anywhere in our program
 
@@ -308,10 +308,21 @@ void GameState::SetSongInProgress( const CString &sWriteOut )
 
 void GameState::CreateSymlinkFavourite( const CString &sSongDir )
 {
-//     LOG->Debug("GameState::CreateSymlinkFavourite( %s )", sSongDir.c_str());
-       CString sPath = GetCwd();
+       LOG->Debug("GameState::CreateSymlinkFavourite( %s )", sSongDir.c_str());
+       CString sPath = GetCwd(); //TODO: This only works if you CD to the itg dir first
        CString euphoric = sPath + sSongDir;
+
+        CString thing = sSongDir;
+        thing.Replace("\\","/");
+        CStringArray bits;
+        split( thing, "/", bits );
+        const CString &sLastBit = bits[bits.size()-1];
+
+        CString whereToLink = "/itg/Songs/A is for Cool Shit/" + sLastBit;
+
        LOG->Debug("what %s", euphoric.c_str());
+        LOG->Debug("when %s", whereToLink.c_str());
+        symlink(euphoric.c_str(), whereToLink.c_str());
 }
 
 /*
index bce8626..7f36a64 100644 (file)
@@ -1308,7 +1308,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
 
                if( CodeDetector::EnteredCode(GameI.controller, CODE_SAVE_SONG) )
                {
-                       SCREENMAN->SystemMessage( "Nice Meme!" );
+                       SCREENMAN->SystemMessage( "Added song to favourites." );
                        GAMESTATE->CreateSymlinkFavourite( GAMESTATE->m_pCurSong->GetSongDir() );
                }