Packaging Windows 8 App Data File - windows-8

I'm developing a Win 8 app and I would like to include a data file with the app. The data file will be unique for each user so it should really reside under /Users/(user)/AppData/Packages/(MyAppPackage)
Is is possible to do that with a deployment/installation package, and if so how?
Thanks.

As far as I know, CMIIW,
You cannot include the data file which your package, unless you put your data file in the application directory / installed directory, then after the first run, you can move it (the data file) to the /Users/(user)/AppData
I believe you will not save sensitive data to the Users/(user)/AppData, since the user can access to the folder with Windows Explorer easily, or if you must save it to AppData, I suggest you to encrypt your data first.
Cheers
Yusak Setiawan
http://apptivate.ms/apps/1271/mathboard

Related

How to store files in an EXE file via vb 2010 app

I need to store files in an EXE file via VB 2010 app. I mean, lets say I made a software called setmaker and one that is called setup.exe. I want setmaker to store some files that you choose in setup.exe, and then when you run setup.exe it reads the files that you stored in it and extracts it to a location specified by you.
The following post How to copy file From Resources? discusses a method for copying a file that is an Embedded resource in an EXE to a folder on disk.
Hope that helps.

How to read a shortcut file (and get its target) in a Windows RT metro app?

I have accessed normal files and folders, but unable to read the target value from a shortcut file. Any idea how to read a shortcut file in WinRT?
My actual requirement is to find the most recently used/opened files in the system This info was previously available through Environment.GetFolderPath(Environment.SpecialFolder.Recent)
Thank you in advance :)
There is a file AppData\Local\recently-used.xbel which contains this information on Win8. Parsing it should be easy, but the problem will probably be to get access to this file as it isn't in the folders that can be accessed via any manifest declaration. Also the AppData folder is hidden, making it inaccessible via the FileOpenPicker.
My guess would be that this is an intentional change by Microsoft since it is no business of a sandboxed app, which documents were used by other apps. If you want to open files that were recently opened by your app, you can roll your own "recently changed" implementation. Which should be easy because you have to save their token to the FutureAccessList anyhow.

Extra files in Windows Store app package

just wondering if it's possible to include some files (one txt file in this case) in the app package that I need in the application folder. The thing is that I might use a piece of code that requires the license to be included in the app as a text file, and I think this would be one way to do it.
Thanks in advance.
Absolutely, it's really no different than including images for instance. And if you need to process the file within your app you can access it via its local path or explicitly use the ms-appx:/// protocol.
See How to reference content and How to load file resources for more details.
Just include the file in your project with Build Action set to Content. You can put it in any folder you like.
The file can then be accessed from the app either using the ms-appx: protocol or using the StorageFolder API:
var license = await Package.Current.InstalledLocation.GetFileAsync("license.txt");

How to publish/code AIR app that will load an XML file and images from the file system?

I'm creating an AIR app that will load an XML file (that can be edited by the user). It will load certain images specified by the XML file.
I'm currently using File.desktopDirectory.resolvePath() to access the XML file and the images from the desktop.
The AS3 reference for the File class specifies these static properties to access files.
File.applicationStorageDirectory—a storage directory unique to each installed AIR application
File.applicationDirectory—the read-only directory where the application is installed (along with any installed assets)
File.desktopDirectory—the user's desktop directory
File.documentsDirectory—the user's documents directory
File.userDirectory—the user directory
Using these would guarantee that the directories resolve correctly for different OS platforms.
So, is my current approach of just placing the XML file and the images(under subfolders) on the desktop the way to go? The user needs to be able to access the XML file to edit it and the folders to add/remove images. Is there an alternative to doing this? I don't think I can put it in the applicationDirectory, b/c the documentation warns against putting anything there that may change.

Creating a temporary file in VB on Windows 7 PC

I have a VB program that creates a temporay PDF file then opens Outlook and attaches the file. I create the file in the application path (the location that the program is running from - normally C:\Program Files\ProgamName). This works fine in XP as it appears there are no crazy permission issues. However in Windows 7, the file does not appear. There are no errors, the file does not exist in that location.
I've changed the path to the root of C:\, however this doesn't work either. I suspect it's something to do with W7 virtualisation, so the question is where can I create a file that I can then access again?
I was trying to avoid creating it on a share on a server, but it's looking like this is the only place to put it as there doesn't seem to be many places a user can write files to in Windows 7.
Surely there must be a location that users can access (without being administrators) to create files. Don't even get me started on the fun I have had with the registry in W7!!!
Thanks
Patrick
You need to create the file in the system's temp directory, which you can find by calling Path.GetTempPath().
In general, your program should only write to files in the user's Application Data (or temp) directories and only write registry keys in HKEY_CURRENT_USER. (This is true in any version of Windows)
If you follow these guidelines, you won't have any trouble in Windwos VIsta or 7.
You should never write information to places that are shared by multiple users.
Edit: While the following will work, SLaks points out it's bad practice, and the temp file won't get cleaned up.
Try %HOMEPATH% - this is the environment variable for a users documents folder, and should work no matter which version if windows you use.
In other words where you used to have:
"c:\programfiles\programname\tempFileName"
use:
"%HOMEPATH%\tempFileName"