Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New way to require app #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

jaygooby
Copy link

@jaygooby jaygooby commented Jul 6, 2016

No description provided.

jaygooby added 7 commits July 6, 2016 11:15
Also extra logging around the unlinking and renaming of the asar
But the AppPathFolder doesn't - even though it's a UNIX /, Windows normalises it to its own \
This is so ugly it hurts. You even see the DOS window, and the `> nul` redirect has no effect, so you see the "Press a key" prompt from the `timeout` command
This is to get around the fact that the prompt text from the timeout command was always being shown, even when redirecting to NUL

The updater.exe is a really simple C# console app, compiled with [Mono](http://www.mono-project.com).

````
// updater.cs
//
// compile to updater.exe using: mcs updater.cs
//
// Takes two arguments; a source file and a destination file
// Waits 5 seconds, then will move source to destination, as long as source exists

using System;

public class CommandLine
{
  public static void Main(string[] args)
  {
    string updateAsar = "";
    string appAsar = "";
    
    // wait for the Electron app to close (5 secs)
    System.Threading.Thread.Sleep(5000);
    
    if (args.Length == 2) 
    {
      updateAsar = args[0];
      appAsar    = args[1];
      
      System.IO.FileInfo fileInfoSrc = new System.IO.FileInfo(updateAsar);
      System.IO.FileInfo fileInfoDest = new System.IO.FileInfo(appAsar);
      
      // the update asar doesn't exist
      if(!fileInfoSrc.Exists) Environment.Exit(1); 
      
      if(fileInfoDest.Exists)                                        
      {
          System.IO.File.Copy(updateAsar,appAsar, true);
          System.IO.File.Delete(updateAsar);                 
      } 
      else
      {
          System.IO.File.Move(updateAsar,appAsar);                 
      }
    } 
    // we need two filepaths - the update.asar and the app.asar
    else 
    {
      Environment.Exit(1);
    }
  }
}
````
@vanekj
Copy link

vanekj commented Mar 1, 2017

@whitesmith Please merge this request :)
Also @jaygooby, how is it with updater.exe? How do I automatically append it to the resources folder? I am using electron-builder to build the App (.app for Mac, installer for Windows). Thank you

@jaygooby
Copy link
Author

jaygooby commented Mar 2, 2017

@vanekj you can get updater.exe from here: jaygooby@7c56ea5 you'll need to install mono to compile it

@manpreetrsystems
Copy link

@AgentWS I am getting error while using electron-asar-updater as "core.require" is not a function.

Any idea how to resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants