How to access files from within an app bundle? #273
Replies: 2 comments
-
It figures that after an hour of poking around unsuccessfully that I would post this and almost immediately stumble into the answer. bundle := foundation.Bundle_MainBundle()
path_to_file := bundle.PathForResourceOfType("foo", "txt") This will return the path to the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for sharing the solution!
Jeff Lindsay
*https://progrium.xyz <https://progrium.xyz>*
…On Tue, Nov 19, 2024 at 2:34 PM Ryan Kennedy ***@***.***> wrote:
It figures that after an hour of poking around unsuccessfully that I would
post this and almost immediately stumble into the answer.
bundle := foundation.Bundle_MainBundle()path_to_file := bundle.PathForResourceOfType("foo", "txt")
This will return the path to the foo.txt file in the
MyApp.app/Contents/Resources directory.
—
Reply to this email directly, view it on GitHub
<#273 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAFB7GJB756IAGUK27UMT2BOHEPAVCNFSM6AAAAABSC3ZI7GVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMZRGA3DSNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've built an app with DarwinKit and placed it into a
.app
bundle, along with some ancillary data files that I need during runtime. How do I access those files? When I use os.Getwd to get the current working directory it appears to be/
.I assume there must be some object that I can use to get the path to where the app bundle is located so I can create the proper path to open my data file. I've skimmed the
appkit.Application
andappkit.ApplicationDelegate
types, but didn't see anything obvious that stood out to me.I realize this is likely more of an Apple development question than a DarwinKit one. But I figured someone here may have run into the same problem and might have the answer I'm seeking.
Beta Was this translation helpful? Give feedback.
All reactions