Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Copy file from Resources to Library\Application Support

$
0
0

Hi there,

I have a SQLite database file that I have a default version of in my Resources directory that is set to copy to the output directory on build.

On app startup I check to see if the user already has my sqlite database file in place if not I want to copy the default file from the resource directory to the user's Library\Application Support directory which I understand is where my sandboxed application can store user data.

What I've not been able to work out programatically is where is my Resource directory path is so I can issue a copy command. I looked at NSHomeWindow() and sample code

[System.Runtime.InteropServices.DllImport("/System/Library/Frameworks/Foundation.framework/Foundation")]
    public static extern IntPtr NSHomeDirectory();

    public static string ContainerDirectory
    {
        get
        {
            return ((NSString)ObjCRuntime.Runtime.GetNSObject(NSHomeDirectory())).ToString();
        }
    }

And am assuming that I use ContainerDirectory as the string representation? However that doesn't seem to point to where my Resources folder is when the app is running.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>