diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-07-17 16:46:58 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-07-17 16:46:58 +0000 |
commit | 329e2b8eabd0f4ecb6e6a9bdc66d595c988d399a (patch) | |
tree | 0edc4be7cae34b876bc7cc2104c5d49f96b28c8a /Game/Code/MacOSX | |
parent | 9a393bf11f43ba649fa28c17408ea91c43c97a93 (diff) | |
download | usdx-329e2b8eabd0f4ecb6e6a9bdc66d595c988d399a.tar.gz usdx-329e2b8eabd0f4ecb6e6a9bdc66d595c988d399a.tar.xz usdx-329e2b8eabd0f4ecb6e6a9bdc66d595c988d399a.zip |
- UPlatformXYZ.pas clean-up
- TPlatform now implements common behaviour
- added TPlatform.Init()
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1207 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/MacOSX')
-rw-r--r-- | Game/Code/MacOSX/Wrapper/UMacResources.pp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/Game/Code/MacOSX/Wrapper/UMacResources.pp b/Game/Code/MacOSX/Wrapper/UMacResources.pp deleted file mode 100644 index 65c817fc..00000000 --- a/Game/Code/MacOSX/Wrapper/UMacResources.pp +++ /dev/null @@ -1 +0,0 @@ -unit UMacResources;
interface
procedure init;
implementation
uses
SysUtils,
Classes;
procedure init;
const
PathName : string = '/Library/Application Support/UltraStarDeluxe/Resources';
var
RelativePath, BaseDir, OldBaseDir : string;
SearchInfo : TSearchRec;
DirectoryList, FileList : TStringList;
DirectoryIsFinished : longint;
counter : longint;
UserPathName : string;
SourceFile, TargetFile : TFileStream;
FileCopyBuffer : array [1..4096] of byte;
NumberOfBytes : integer;
begin
getdir (0, OldBaseDir);
BaseDir := OldBaseDir + '/UltraStarDeluxe.app/Contents/Resources';
chdir (BaseDir);
UserPathName := GetEnvironmentVariable('HOME') + PathName;
DirectoryIsFinished := 0;
DirectoryList := TStringList.Create();
FileList := TStringList.Create();
DirectoryList.Add('.');
repeat
RelativePath := DirectoryList[DirectoryIsFinished];
chdir (BaseDir + '/' + RelativePath);
if (FindFirst('*', faAnyFile, SearchInfo) = 0) then
repeat
if DirectoryExists(SearchInfo.Name) then
begin
if (SearchInfo.Name <> '.') and (SearchInfo.Name <> '..') then
DirectoryList.Add(RelativePath + '/' + SearchInfo.Name);
end
else
Filelist.Add(RelativePath + '/' + SearchInfo.Name);
until (FindNext(SearchInfo) <> 0);
FindClose(SearchInfo);
DirectoryIsFinished := succ(DirectoryIsFinished);
until (DirectoryIsFinished = DirectoryList.Count);
if not DirectoryExists(UserPathName) then
mkdir (UserPathName);
for counter := 0 to DirectoryList.Count-1 do
if not DirectoryExists(UserPathName + '/' + DirectoryList[counter]) then
mkdir (UserPathName + '/' + DirectoryList[counter]);
DirectoryList.Free();
for counter := 0 to Filelist.Count-1 do
if not FileExists(UserPathName + '/' + Filelist[counter]) then
begin
SourceFile := TFileStream.Create(BaseDir + '/' + Filelist[counter], fmOpenRead);
TargetFile := TFileStream.Create(UserPathName + '/' + Filelist[counter], fmCreate);
repeat
NumberOfBytes := SourceFile.Read(FileCopyBuffer, SizeOf(FileCopyBuffer));
TargetFile.Write(FileCopyBuffer, NumberOfBytes);
until (NumberOfBytes < SizeOf(FileCopyBuffer));
SourceFile.Free;
TargetFile.Free;
end;
FileList.Free();
chdir (OldBaseDir);
end;
end.
\ No newline at end of file |