From 5b59a65a7a1caed5893e38f70c0ff45aff710e22 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Fri, 3 Apr 2015 06:25:41 +0800 Subject: [PATCH] Awful --- src/GameState.cpp | 17 ++++++++++++++--- src/ScreenEvaluation.cpp | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/GameState.cpp b/src/GameState.cpp index e1e075fe..9dd73bfb 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -26,7 +26,7 @@ #include #include - +#include 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()); } /* diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index bce86263..7f36a64a 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -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() ); } -- 2.11.0