aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-11-29 20:37:46 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-11-29 20:37:46 +0000
commitccbf6ee893829ec067a629d7fa7771d3e73e4081 (patch)
treed7f805166324c89ff6aa984fd5fdb15493833fc2
parentd826e9135078f7fa719046069ce10da1e382bfc3 (diff)
downloadusdx-ccbf6ee893829ec067a629d7fa7771d3e73e4081.tar.gz
usdx-ccbf6ee893829ec067a629d7fa7771d3e73e4081.tar.xz
usdx-ccbf6ee893829ec067a629d7fa7771d3e73e4081.zip
folders in Library/Application\ Support/UltraStarDeluxe/Resources can also be symlinks. No aliases, however. Courtesy to Filipe Cabecinhas.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1531 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UPlatformMacOSX.pas19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/base/UPlatformMacOSX.pas b/src/base/UPlatformMacOSX.pas
index 0b44b76a..9085e337 100644
--- a/src/base/UPlatformMacOSX.pas
+++ b/src/base/UPlatformMacOSX.pas
@@ -154,6 +154,9 @@ begin
end;
procedure TPlatformMacOSX.CreateUserFolders();
+const
+ // used to construct the @link(UserPathName)
+ PathName: string = '/Library/Application Support/UltraStarDeluxe/Resources';
var
RelativePath: string;
// BaseDir contains the path to the folder, where a search is performed.
@@ -172,11 +175,12 @@ var
// searched for additional files and folders.
DirectoryIsFinished: longint;
Counter: longint;
+ // These three are for creating directories, due to possible symlinks
+ CreatedDirectory: boolean;
+ FileAttrs: integer;
+ DirectoryPath: string;
- UserPathName: string;
-const
- // used to construct the @link(UserPathName)
- PathName: string = '/Library/Application Support/UltraStarDeluxe/Resources';
+ UserPathName: string;
begin
// Get the current folder and save it in OldBaseDir for returning to it, when
// finished.
@@ -221,7 +225,12 @@ begin
ForceDirectories(UserPathName); // should not be necessary since (UserPathName+'/.') is created.
for Counter := 0 to DirectoryList.Count-1 do
begin
- if not ForceDirectories(UserPathName + '/' + DirectoryList[Counter]) then
+ DirectoryPath := UserPathName + '/' + DirectoryList[Counter];
+ CreatedDirectory := ForceDirectories(DirectoryPath);
+ FileAttrs := FileGetAttr(DirectoryPath);
+ // Don't know how to analyse the target of the link.
+ // Let's assume the symlink is pointing to an existing directory.
+ if (not CreatedDirectory) and (FileAttrs and faSymLink > 0) then
Log.LogError('Failed to create the folder "'+ UserPathName + '/' + DirectoryList[Counter] +'"',
'TPlatformMacOSX.CreateUserFolders');
end;