In developing a WinRT 8.1 app, I think that the Uri has to be only of known file extensions? Is that correct? For example, the following snippet will cause an exception on the GetFileFromApplicationUriAsync call even if this file exists as shown:
Uri uri = new Uri("ms-appx:///Assets/lake800x600.flanker");
StorageFile file = await
StorageFile.GetFileFromApplicationUriAsync(uri).AsTask().ConfigureAwait(false);
However, if I change the file extension and the URI to '.dat' or '.txt' it works fine. Is this a known issue? Why can't I refer to and use files of any extension?
You need to make sure your files are marked as content so they are included in the appx package.
Typical data file types such as .txt and .jpg will default to content, but you'll need to set it explicitly for other file types.
Compare a text file:
And a .dat file:
You can confirm by creating a package (Store.Create app packages...), renaming the .appx to .zip, and opening it to see the files. You can also check the Appx folder created in your app's bin\Debug\Appx directory when you deploy and run from Visual Studio
Related
I have a problem adding a chrome extension to my project using Puppeter
For example, I have a folder where I keep the extension in .crx format
const pathToExtension = path.join(process.cwd(), 'extentions');
That's how I take the path.
After thatI add the path to the arguments
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
But when I start the application I get this error
Failed to load extension from: /Users/andrew/Desktop/projects/personal-project/extentions. Manifest file is missing or unreadable
To specify that in that extensions folder I have the extension defined like this
ext.crx
Is there a way to add this extension?
I have used Pyinstaller to pack my script as onedir EXE, then installed to Program Files folder. i used this line to save a json to a file:
json.dump(data, open("data_file.json",'w'))
on some computers the file saved to where EXE is which is what i want, but others save it to different locations.
so when i try to get the file using json.load it says not file found:
json.load(open("data_file.json"), encoding="utf-8")
How can i solve this issue so the script only save files to the same EXE directory?
The cause of the problem is related to writing permission on windows. so instead of writing app data to the Program Files folder which is not recommended, you need to write the data to APPDATA folder.
i have used the code posted by giuliano-oliveira and it works perfectly cross platform.
get_user_data_dir
How to avoid file download, if the file is already present in my local.
My Code:
<
a href="file:///C:/Users/t_smrithik/Desktop/DNS.cap">DNS.cap
I do not want to download this file again. I just want to open it. The file gets downloaded to a temp folder and then the Wireshark app(app used to open cap files) loads it.
Javascript cannot access the filesystem and check for existence. The only interaction with the filesystem is with loading js files and images (png/gif/etc).
Javascript is not the task for this
I'm trying to make a UWP file browser app that show all the files from http://192.168.201.254/media/, to do that I need to get all the file paths under http://192.168.201.254/media/, is there a way to do it?
Clients can only request known file URLs via HTTP.
The server can be configured to spit out an HTML file list as default page for the directory and you can process that on the client side.
How can i access a file "without" extension in metro application?
Normally you would need to declare the capabilities of the application incl. a declaration which filetype/extension you wanna access, if the file is located in the document library. The problem is the file i wanna access dont have an extension.
Im trying to access some files within a git directory.
Windows has always used the file extension for association with a program. A file without an extension cannot be associated with a program.