Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kit Redgrave
SRB2
Commits
928c6acf
Commit
928c6acf
authored
9 years ago
by
Kit Redgrave
Browse files
Options
Downloads
Patches
Plain Diff
Simplify OS X bundle resource discovery, fix a sigsegv
parent
a12733f4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sdl/macosx/mac_resources.c
+13
-15
13 additions, 15 deletions
src/sdl/macosx/mac_resources.c
with
13 additions
and
15 deletions
src/sdl/macosx/mac_resources.c
+
13
−
15
View file @
928c6acf
...
@@ -9,23 +9,21 @@ void OSX_GetResourcesPath(char * buffer)
...
@@ -9,23 +9,21 @@ void OSX_GetResourcesPath(char * buffer)
mainBundle
=
CFBundleGetMainBundle
();
mainBundle
=
CFBundleGetMainBundle
();
if
(
mainBundle
)
if
(
mainBundle
)
{
{
const
int
BUF_SIZE
=
256
;
// because we somehow always know that
CFURLRef
appUrlRef
=
CFBundleCopyBundleURL
(
mainBundle
);
CFURLRef
appUrlRef
=
CFBundleCopyBundleURL
(
mainBundle
);
CFStringRef
macPath
=
CFURLCopyFileSystemPath
(
appUrlRef
,
kCFURLPOSIXPathStyle
);
CFStringRef
macPath
=
CFURLCopyFileSystemPath
(
appUrlRef
,
kCFURLPOSIXPathStyle
);
CFStringRef
resources
=
CFStringCreateWithCString
(
kCFAllocatorMalloc
,
"/Contents/Resources"
,
kCFStringEncodingASCII
);
const
void
*
rawarray
[
2
]
=
{
macPath
,
resources
};
const
char
*
rawPath
=
CFStringGetCStringPtr
(
macPath
,
kCFStringEncodingASCII
);
CFArrayRef
array
=
CFArrayCreate
(
kCFAllocatorMalloc
,
rawarray
,
2
,
NULL
);
CFStringRef
separator
=
CFStringCreateWithCString
(
kCFAllocatorMalloc
,
""
,
kCFStringEncodingASCII
);
if
(
CFStringGetLength
(
macPath
)
+
strlen
(
"/Contents/Resources"
)
<
BUF_SIZE
)
CFStringRef
fullPath
=
CFStringCreateByCombiningStrings
(
kCFAllocatorMalloc
,
array
,
separator
);
{
const
char
*
path
=
CFStringGetCStringPtr
(
fullPath
,
kCFStringEncodingASCII
);
strcpy
(
buffer
,
rawPath
);
strcpy
(
buffer
,
path
);
strcat
(
buffer
,
"/Contents/Resources"
);
CFRelease
(
fullPath
);
}
path
=
NULL
;
CFRelease
(
array
);
CFRelease
(
resources
);
CFRelease
(
macPath
);
CFRelease
(
macPath
);
CFRelease
(
appUrlRef
);
CFRelease
(
appUrlRef
);
//CFRelease(mainBundle);
CFRelease
(
separator
);
}
}
CFRelease
(
mainBundle
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment