My app stores a large collection of file references in a database by using the URL Bookmark. These files are located on removable BD-R media, so once stored, the files are taken offline (by the nature of removable media).
I notice that a URL Bookmark to "File A" on BD-R A will sometime incorrectly resolve to "File B" on BD-R B once BD-R B is placed in the drive and made accessible.
This massively messes up the database and bookmarks are resolving to seemingly random files depending on what disc is currently online.
Related
I followed the “build mobile apps with Xamarin.Forms” course. On the “store local data with SQLite in a Xamarin.Forms app” section, they say iOS provides two folders to deal with the files saved on a device:
the Documents folder, for user-generated data only.
the Library folder, for for app-generated data.
Then, this subsection is presented:
What I don’t understand is: is this the correct way to deal with the iOS Documents folder? I ask this because they explicitly say libFolder contains the appropriate Library location. What about the Documents folder required by Apple’s guidelines?
There are detailed information about different purposes of folders in iOS, in this document:
Documents:/
Use this directory to store user documents and application data files.
The contents of this directory can be made available to the user
through iTunes file sharing (although this is disabled by default).
Add a UIFileSharingEnabled Boolean key to the Info.plist file to allow
users to access these files.
Even if an application doesn’t immediately enable file sharing, you
should avoid placing files that should be hidden from your users in
this directory (such as database files, unless you intend to share
them). As long as sensitive files remain hidden, these files will not
be exposed (and potentially moved, modified, or deleted by iTunes) if
file sharing is enabled in a future version.
You can use the Environment.GetFolderPath
(Environment.SpecialFolder.MyDocuments) method to get the path to the
Documents directory for your application.
The contents of this directory are backed up by iTunes.
Library/:
The Library directory is a good place to store files that are not
created directly by the user, such as databases or other
application-generated files. The contents of this directory are never
exposed to the user via iTunes.
You can create your own subdirectories in Library; however, there are
already some system-created directories here that you should be aware
of, including Preferences and Caches.
The contents of this directory (except for the Caches subdirectory)
are backed up by iTunes. Custom directories that you create in Library
will be backed up.
Please read the document and feel free to ask if you have other problems.
Update
to access update answer:
iOS:
string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string libFolder = System.IO.Path.Combine(docFolder, "..", "Library");
Android:
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
I have a sandboxed application that uses a document format which can contain embedded filenames. E.g. some of these referenced files are for image files which the user selects in order to associate the image file with data stored in the document. Whilst such images will sometimes be located in the users pictures folder, sometimes they are elsewhere. The document format itself cannot be changed for portability reasons (it is shared with an existing Windows version of the app).
In order for the app to be able to access the files whose names are embedded within the document, when the user selects a filename (using nsopenpanel) to be stored in the document like this, the app also creates an app-scoped security scoped bookmark for each such stored filename. It then stores these bookmarks by serialising them to another file. When the app runs again it loads its previously serialised bookmarks and uses them when accessing the 'embedded' filename and that works fine.
But when I copy such a document (and its associated serialised bookmarks file) from one Mac to another, it doesnt work, even though all the files the bookmarks refer to are known to exist on both Macs. What happens is that whilst the app opens the document file ok (after the user selected it with an nsopenpanel), and successfully reads in the serialised bookmarks from its associated serialised bookmarks file (which again the user has selected using nsopenpanel), and even though the exact same filenames that the bookmarks refer to are known to exist on the other Mac (and can be accessed by the user through finder etc), the sandboxed app still cannot access them. Resolving the bookmarks seems to fail.
The question is: are app-scoped bookmarks restricted to only working on the Mac on which they were created? If I cannot move an app-scoped bookmark from one system to another, how else can I achieve the effect I want without forcing the user to have to manually re-select every such 'embedded' filename with an nsopenpanel?
Tried to find the answer to this question in the Apple docs without success.
I take it it goes without saying that security-scoped bookmarks can only be used by the app that creates them.
No, because if this were possible, developers could save security-scoped bookmarks to sensitive files/directories on their own computers and then deploy their apps and have access to those same sensitive files/directories on other peoples' computers.
I have saved a complete webpage and there is also one folder saved with resources but when I delete webpage or move saved webpage to other directory then the folder associated with it also gets deleted or moved. So what is the code written behind it. Because I want to do same with my webpage and folder.
Thanks in advance for you kind help.
This "association" between the HTML file and its resources folder is a behaviour implemented by the Windows operating system.
It has nothing to due with a webpage in particular, with its HTML, JavaScript, or even with a particular browser.
Windows 2000 provides a simple way to connect a primary HTML file to its group of associated files. If Connected Files is enabled, when you perform any of the commands [Copy, Cut, Paste, Move, Delete, Send To] on a file or folder of associated files, the same command is performed on all connected files.
Even though the official page mentions "Windows 2000", the same behaviour is implemented in Windows XP and many (if not all) later versions of Windows.
See these pages:
Removing file / folder link after using “Save As…” then “Web Page, complete”
Operations on an HTML file or folder apply to similarly named folder or HTML file (from Microsoft support)
I have recently transferred a few files from my external backup disk to my hard drive. I noticed that indexing services were running wild for a long time. I figured out that I had some really large pdf files that windows was trying to ndex.
What I found as a solution was to go to Control Panel->Indexing Options->File Types, locate the .pdf file type and change its filter to "Index properties only". I have later realized that I never in my life had the necessity to search generally a group of files for a specific term. So I went in all file types and changed their filter to "Index properties only".
Is there any way to change the filter to "Index properties only" for all file types without selecting each and changing it manually?
is there a way to "hook" into the OSX Finder to perform the following:
When my Application starts, the User sees a Folder in his Finder which is created by my application. Inside this Folder the User sees Files from several Folders...a unified view to several Files in several Folders that the User specified in my Application.
So, in this "Unified Folder" are not the real Files, they are still in there original Folder but the User sees them in this one Folder as if there were all his real Files in this new Folder. So there is no copying or moving involved.
To be honest, I've no Idea if it's possible and what I should looking for inside the Cocoa SDK. Maybe there is an API for the Finder itself or some other way?!
Regards
twickl
First option is your application could create aliases to the original files. The Finder will show these with a small arrow "badge" over the icon, so it is clear they are not the original files but aliases of them.
If you don't like the badges on the icons creating hard links may give you what you want.
Mac OS X presents a view of the HFS+ (Mac) filesystem which matches the UFS (Unix) one and you have access to hard and symbolic links. The latter are treated by the Finder similar to aliases but the former are indistinguishable from the original files as they are the original files - under the Unix filesystem a file in a directory is just a reference (the inode number) to the real file, each entry in a directory is just a hard link to the actual file, and a file can have any number of hard links to it (a file is deleted when the link count drops to 0, think of the retain/release model if that helps).
At the Cocoa level NSFileManager has methods to create hard links, or you can use the Unix level link(2) function.