Electron Squirrel.Windows: How can I remove local app data on uninstall? - electron

Currently I have an installer built with Squirrel.Windows. On uninstall, the application directory under:
C:\Users\Me\AppData\Local\MyApplicationDirectory
remains. I have tried using rimraf under the the --squirrel-uninstall hook to remove the directory, but it fails because the files are in use.
Here is what I have that is not working:
case '--squirrel-uninstall':
var myLocalAppData = "C:\\Users\\Me\\AppData\\Local\\MyApplication";
rimraf(myLocalAppData);
app.quit();
I have tried the following to no avail:
Using a setTimeout() to delay the rimraf(myLocalAppData) call
Using the maxBusyTries param in the rimraf options to continue retrying for 10 seconds if a EBUSY, ENOTEMPTY, or EPERM error code is encountered when trying to clean up the directory
Running app.exit() before the rimraf(myLocalAppData)
I know the NSIS installer provided by electron-builder properly cleans up the app data directory, but I cannot use it as I need a MSI to support machine wide installations via Group Policy Management.
Any help is appreciated!

Related

Delphi 5 Installation Error

I am trying installing Delphi 5 on my computer. As soon as the installation starts I get:
Error copying File
followed by:
Setup has detected a -113 error while attempting to copy files. This
indicates that setup could not find a file in the "RunImage" directory.
Now the setup file does includes "RunImage" directory. The File is located in the D drive on another computer which I have mapped to my computer as Drive Z and I am running it from the Mapped Drive Z.
I searched online for this Error. Some recommend that if I am installing from a network location then the location has to mapped to my computer as a Driver with a name to solve the issue. I did map the location but still getting the same error.
As J.. already suggested in his comment: Windows >= Vista automatically runs programs containing the string "setup" in the name in elevated mode. In that mode, you don't have the same mapped drives as in your normal user mode. So, the program starts (which is actually inconsistent with security model, because in elevated mode, the executable itself should not be available) and then cannot find any additional files because the drive mapping does not exist.
Solution: Copy the whole installation directory to a local drive. You can delete it after the installation has finished.
Note: While I think this will solve that particular problem, it does not mean, that the rest of the installation will work.
i had same problem and i solved it by this method:
After unpacking the archive(the delphi5 zip file that you downloaded), make the root directory with the command Subst X: "path to installer". Run the standard Borland installer, the Install.exe program, there.

Creating laravel apps without internet connection

Does laravel 5.1 work without internet connection?
I like to create a laravel new application
when i execute laravel new test (with intenet connection) it works well;
but when i execute similar command in the same directory (new anotherName) without internet connection it doesn't work and the nest error message is shown
[GuzzleHttp\Exception\RequestException]
Error creating resource. [url] http://cabinet.laravel.com/latest.zip [type]
2 [message] fopen(http://cabinet.laravel.com/latest.zip): failed to open s
tream: php_network_getaddresses: getaddrinfo failed: Name or service not kn
own [file] /home/<Myname>/.composer/vendor/guzzlehttp/guzzle/src/Adapter/Str
eamAdapter.php [line] 367
Is there a solution because i can't work online always?
When you use the laravel installer it fetches the latest version from the server. One solution would be to initialise a Laravel project, then add it to git version control and then when offline checkout the project to a new folder. You'd have to manually choose a new app key (I think). You will also not be able to composer require or npm install any new packages while offline.
Once you have created it though it should run offline (unless your views are sourcing assets from, say, bootstrap or jQuery CDNs).
Composer 2+:
COMPOSER_DISABLE_NETWORK=1 laravel new myapp
Troubleshooting:
Check your composer version: composer --version - you may have to update to the latest version with composer self-update;
Check you have a global cache: echo $COMPOSER_HOME - you may have to create a ~/.composer and set export COMPOSER_HOME="${HOME}/.composer" to your ~/.bashrc or ~/.zshrc - don't forget to close and open your terminal to apply the changes;
If you get this error https://repo.packagist.org could not be fully loaded (Network disabled, request canceled: https://repo.packagist.org/packages.json), package information was loaded from the local cache and may be out of date, the laravel packages are not in the global cache. Run the command with internet enabled to download the files.

Error while running pub deploy: Cannot read link

I'm trying to run pub deploy command in my Dart project, but it always ends with this error: "Pub deploy failed, [1] Cannot read link". No more information outputs into console.
I tried to run it in basic Dart browser project (the one with text reversing), but same error occurred again.
Did anyone have same problem? Any ideas how to fix it?
I have the same issue.
In my case, the Dart project is stored in NTFS hard drive (I share it with Windows OS) and Dart deploy (run from Eclipse) runs on Ubuntu.
Simply move the Dart project to Ubuntu hard drive then things come back to normal.
GS
This is probably a problem with the packages symlinks. If you delete them and run pub install it should work again.
According to dart-sdk/lib/io/link.dart:
On the Windows platform, the link will be created as a Junction
On other platforms, the posix symlink() call is used to make a symbolic link
On Linux platforms, storing Dart project in NTFS drive causes Pub to fail. Because posix symlink() is used on NTFS partition and doesn't create a valid NTFS junction point.
The solution is to move the project folder to a partition that uses posix symlinks natively, such as one formatted to ext4.

Trigger.io continuous development

I'd like to know if there is any way to develop continuously with Trigger.io and avoid the forge build step with every file change I want to test in my browser or simulator.
I was faced with the same problem and I've got a working solution that uses watchr and watch to automatically rebuild each time I make a change to a source file. If you are running a "web" version of your app you can make a change to a source file and go directly to your browser and see the effect of your changes fairly quickly depending on how long the build takes.
Prerequisites: Ruby, watchr, Unix 'watch', and a terminal.
gem install watchr.
create a new ruby file for watchr to know what files to monitor and what to do when it sees a change. I named my file 'my_watch.rb': https://gist.github.com/3153167
open two terminals. Terminal 1 will run watchr and Terminal two will run 'forge build ...'.
In terminal 1 run 'watchr my_watch.rb' making sure the path to my_watch.rb is correct and make sure you've edited my_watch.rb according to your setup so that the path inside watch(...) reflects the files to be watched. My example watches all files in the same directory (and beneath) as the my_watch.rb script. You can place my_watch.rb in the 'src' folder of your Trigger.io app if you want to match my example and run watchr my_watch.rb directly from the src folder. Also not the shell command and path in the block need to be updated to reflect your environment. Again, in my example 'my_watch.rb' is inside 'src/' so when a change is detected we go up one directory and call 'forge build'.
I tend to develop actively with the 'web' version of my app so I can just open terminal 2 to my forge project directory and 'forge run web'. When I am testing in simulators and on devices, yes I have to run forge build every time I want to see a change. However, I typically don't have to wait for forge build to finish because watchr kicked off the build as soon as I made a change and it happens pretty quickly.
I know this is not an ideal solution but so far developing new features in the 'web' version first and then implementing in mobile versions has been very smooth for me. I've never needed to kill the 'web' version after a build but I maybe just lucky. As for running build each time you want to test the mobile versions if you are good with your keyboard shortcuts it really isn't bad at all. XCode makes you build and run after changes are made to source code when creating native iOS apps so I don't think Trigger is unique in requiring this build step.
I hope this helps and that my answer isn't too specific to me and my setup.
The build phase makes some changes to your source to enable the forge.* APIs - therefore, trying to just use the raw files in your src directory won't work.
You may be tempted to change files directly in the development directory, but this is a pretty bad idea: we delete those files with impunity when we need to!
We have plans on our medium-term roadmap to add a file-system watcher to start builds automatically when changes have occurred.
In the meantime, I just use forge build && forge run PLATFORM which tends to only take a few seconds...
while not perfect... this works for me.
go into development/web
rm src
link to your root src, ie ln -s ../../src src
copy the all.js from the web/forge and add to your index.html
ie
start nodemon web.js
open in browser.
note you will need to comment out the all.js script tag for non web builds.

AIR3 Native Process will not start in release build

Currently I am building an application that launches crtmpd (a rtmp server written in C++).
Whenever I launch the application from within Flash Builder it works great, if I install a release build from an air file the process.start() returns a generic "could not start process" error.
The crtmpserver.exe is stored in applicationDirectory and the config file is kept in applicationStorageDirectoy.
So I've moved it to the native storage directory. But the problem persists. I've found the following though:
startupInfo = new NativeProcessStartupInfo();
startupInfo.executable = binFile;
processArgs = new Vector.<String>();
processArgs.push(luaFile.nativePath);
startupInfo.arguments = processArgs;
In the IDE after this startupInfo is setup correctly. On client machines all properties of startupInfo are still null.
You might want to try putting it in the application storage directory. I've seen permissions issues were the user wasn't Admin and could't run a native process once it was installed.
The problem was I was packaging with an Air installer rather than a native installer.
Once I packaged with the appropriate installer the problem has resolved itself.

Resources