From cafa9b8034cbff7f7c3507f3f1b0b03a2e5455f7 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Fri, 28 May 2010 22:35:34 +0000 Subject: add Music/Ultrastar Deluxe as a song folder. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2424 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UPathUtils.pas | 5 +++++ src/base/UPlatform.pas | 1 + src/base/UPlatformMacOSX.pas | 26 ++++++++++++++++++++------ 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/base') diff --git a/src/base/UPathUtils.pas b/src/base/UPathUtils.pas index c2bcdd4b..eb98302e 100644 --- a/src/base/UPathUtils.pas +++ b/src/base/UPathUtils.pas @@ -154,6 +154,7 @@ end; procedure InitializePaths; var SharedPath, UserPath: IPath; + MacOSXSongPath: IPath; begin // Log directory (must be writable) if (not FindPath(LogPath, Platform.GetLogPath, true)) then @@ -185,8 +186,12 @@ begin // Add song paths AddSongPath(Params.SongPath); +{$IF Defined(DARWIN)} + AddSongPath(Platform.GetMusicPath); +{$ELSE} AddSongPath(SharedPath.Append('songs')); AddSongPath(UserPath.Append('songs')); +{$IFEND} // Add category cover paths AddCoverPath(SharedPath.Append('covers')); diff --git a/src/base/UPlatform.pas b/src/base/UPlatform.pas index 11c67fa7..6d884979 100644 --- a/src/base/UPlatform.pas +++ b/src/base/UPlatform.pas @@ -51,6 +51,7 @@ type procedure Halt; virtual; function GetLogPath: IPath; virtual; abstract; + function GetMusicPath: IPath; virtual; abstract; function GetGameSharedPath: IPath; virtual; abstract; function GetGameUserPath: IPath; virtual; abstract; end; diff --git a/src/base/UPlatformMacOSX.pas b/src/base/UPlatformMacOSX.pas index 6f718bcd..7115a6b0 100644 --- a/src/base/UPlatformMacOSX.pas +++ b/src/base/UPlatformMacOSX.pas @@ -108,7 +108,10 @@ type *} procedure CreateUserFolders(); - function GetHomeDir(): IPath; + {** + * GetHomeDir returns the path to $HOME. + *} + function GetHomeDir: IPath; public {** @@ -125,9 +128,15 @@ type *} function GetLogPath: IPath; override; + {** + * GetMusicPath returns the path for music. Currently it is set to + * $HOME/Music/UltraStar Deluxe/. + *} + function GetMusicPath: IPath; override; + {** * GetGameSharedPath returns the path for shared resources. Currently it - * is set to /Library/Application Support/UltraStarDeluxe. + * is also set to $HOME/Library/Application Support/UltraStarDeluxe. * However it is not used. *} function GetGameSharedPath: IPath; override; @@ -135,7 +144,7 @@ type {** * GetGameUserPath returns the path for user resources. Currently it is * set to $HOME/Library/Application Support/UltraStarDeluxe. - * This is where a user can add songs, themes, .... + * This is where a user can add themes, .... *} function GetGameUserPath: IPath; override; end; @@ -251,19 +260,24 @@ begin Result := GetExecutionDir().GetParent().GetParent(); end; -function TPlatformMacOSX.GetHomeDir(): IPath; +function TPlatformMacOSX.GetHomeDir: IPath; begin Result := Path(GetEnvironmentVariable('HOME')); end; function TPlatformMacOSX.GetApplicationSupportPath: IPath; begin - Result := GetHomeDir().Append('Library/Application Support/UltraStarDeluxe', pdAppend); + Result := GetHomeDir.Append('Library/Application Support/UltraStarDeluxe', pdAppend); end; function TPlatformMacOSX.GetLogPath: IPath; begin - Result := GetHomeDir().Append('Library/Logs/UltraStar Deluxe', pdAppend); + Result := GetHomeDir.Append('Library/Logs/UltraStar Deluxe', pdAppend); +end; + +function TPlatformMacOSX.GetMusicPath: IPath; +begin + Result := GetHomeDir.Append('Music/UltraStar Deluxe', pdAppend); end; function TPlatformMacOSX.GetGameSharedPath: IPath; -- cgit v1.2.3