Where is the best location to put a Mac helper app inside the bundle of another app? I can't find a definitive answer to this (including what is acceptable for the Mac App Store)
As for any bundle, you can create a folder named Support inside the directory:
XYZ.app/
Info.plist
XYZ
Icon.png
Support/
SomeHelper
Related
Right now I store my files right inside installed app directory and on macOS after deleting an application all saved files are gone too because they were right inside .app directory.
Where should I store files so they will not be deleted after deleting an application? Both on Windows and macOS.
For example, electron-store on macOS stores all data here: ~/Library/Application Support/App Name/ but I don't know where exactly it stores it on Windows.
More context:
I have an Electron app that stores images that user saves and show it inside the app. But the user shouldn't have an easy access to these images using any file provider because these images are the part of the database and I store paths and information about them. Hope it helps :)
Typically data is stored in the user’s “app data” folder where this directory is varies by operating system.
Mac OS: ~/Library/Application Support/{Your App Name (taken from the name property in package.json)}
Windows: C:\Users\\AppData\Local{Your App Name}
Linux: ~/.config/{Your App Name}
Electron provides app.getPath which returns the right directory, depending on your platform.
check this link for more info electron-store-data
I'm using node fs to create a directory and then watch it in my electron app. Users can then use that directory to upload documents. I use chokidar to watch the directory for documents. This all works locally; fs creates the directory inside my app folder. I can drag and drop files in, everything works.
This doesn't work, however, when I deploy the app to windows. I've searched the filesystem and cannot find where this folder was created.
What I'd like to do is create the folder on their Desktop. It would be even cooler if I could react to movements of the folder (e.g. the user moves it to Documents).
Is there a way to
Create the folder on their desktop (both osx and windows)
Listen for when the folder has been moved to another location.
Thanks!
Update
Found a way to find their desktop directory
const dir = Path.join(require('os').homedir(), 'Desktop/whatever');
Is there a way to do number 2?
Is there any specific folder where I can store my files so that the app can use it later after building? Like Meteor has a private folder, is there any folder for node webkit?
As far as I know there is no predefined path and it is not needed. You can access any file with relative path from current dir. Just do not forget to add it into final build.
We're building a node-webkit/NW.js application for OS X and want to create a updater for the application so that it will be kept up-to-date automatically.
Because we deploy the nodeJS, css and html in a App.nw package. It's quite easy to download a new package and just replace the old one and restart the application. After searching somewhat on Google we couldn't find any way of getting the location of the App.nw package on OS X.
We deploy a node-webkit redist on OS X but we use our own CEF client for Windows. On Windows it's quite simple, you just get the NW.exe path and work your way to the App.nw from there. Is there some way of doing that on OS X?
Also it might be good to state that we're working on an older version of node-webkit, version 0.8.6. This is because a lot of native modules don't work on 0.9+ of node-webkit because they need NodeJS 0.10.
While you are running your app your can do:
var path = window.location.pathname;
path = path.substr(0, path.lastIndexOf('/'));
That will give your the full path to the app.nw.
The answer is different depending upon whether you are working in a Terminal (command line) window or from Finder.
In OS X, the nw application is called nwjs. You can look around inside the application bundle by right clicking on the application and selecting the Show Package Contents menu item. Navigate to Contents -> Resources and you will see your App.nw file or directory there.
From the command line, go to the directory containing the nwjs app. It should have the name, nwjs.app. From that directory the file (or directory) that you want is nwjs.app/Contents/Resources/App.nw
When customizing your packaged application it is perfectly ok to rename nwjs.app to your_app_name.app. So the name of the app might be something different from nwjs.app.
I am working in Xamarin to build an iOS iPad app.
I have created a folder called Resources in the project root e.g. ProjectName/Resources. Within here is a subfolder ProjectName/Resources/Images. I have added 2 images into the Images folder.
Then, in Interface Builder (in Xcode), I have added a UIImageView to my xib file and gone to the Image drop down in the attributes inspector. There are no images available to select.
Maybe I have to add them via Xcode instead? If so what are the correct steps and file structures to use?
What is the correct way to work with images and make them available for selection in Interface Builder?
Xamarin Studio only exports images that would live in the top-level app bundle directory when the app gets compiled. This is because Xcode's .xib files only seem to be able to refer to images in the top-level app bundle.
There are multiple ways of achieving your goal:
The first option is to specify a LogicalName to be whatever you want the name to be inside of the compiled app bundle. In Xamarin Studio, this property is called the Resource ID (may or may not be available depending on which version of Xamarin Studio you are using - it was only recently added). You can also set the LogicalName by editing the *.csproj file like so:
<BundleResource Include="Icons\icon.png">
<LogicalName>icon.png</LogicalName>
</BundleResource>
Normally, that Icons\icon.png file would be copied into the iOS app bundle as Icons/icon.png, however, the LogicalName property overrides the relative install path/name. In this case it would be copied over as simply icon.png.
As another example, you can also do this:
<BundleResource Include="Icons\iOS\icon.png">
<LogicalName>AppIcon.png</LogicalName>
</BundleResource>
This will copy the Icons\iOS\icon.png file into the root of the iOS app bundle and also rename it to AppIcon.png.
A second option is to simply move your image file(s) into the Resources folder. The Resources folder is a special directory that gets stripped out of the default path names when copied over to the iOS app bundle. In other words, Resources\icon.png would be copied over into the root of the iOS app bundle as icon.png rather than Resources\icon.png as is the case with normal project directories.
A third option is to simply register other "Resource" directories of your own (and they can exist within other directories, including the default Resources directory).
For example, you could have the structure in your project:
Resources/
Icons/
icon.png
icon#2x.png
And in your *.csproj file, edit the following tag:
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
and replace it with:
<IPhoneResourcePrefix>Resources;Resources\Icons</IPhoneResourcePrefix>
This will ensure that the icon.png and icon#2x.png files are installed in the root of the iOS app bundle.