How to package a NW.js application on Windows

后端 未结 3 1537
抹茶落季
抹茶落季 2021-02-04 19:17

I am reading the instructions for how to package a NW.js app and the wording is a confusing mess and makes no sense. I highlighted the contradictory word-salad parts.

3条回答
  •  甜味超标
    2021-02-04 19:22

    You're welcome to my batch file that automates everything. It compiles, updates time stamps of all files to be included, and runs your app for testing.

    Works perfect under XP or W7.

    NB: Just search & replace all instances of "SourceDir", "DestinDir", and "ProgName" as required.

    @echo off
    title ProgName Compile & Run Script (c) 2016
    cls
    set FILETOZIP=C:\SourceDir\*.*
    set TEMPDIR=C:\temp
    : rmdir %TEMPDIR%
    mkdir %TEMPDIR%
    xcopy /s %FILETOZIP% %TEMPDIR%
    cd C:\temp
    copy /b *.* +,,
    cd C:\DestinDir
    echo Set objArgs = WScript.Arguments > Temp.vbs
    echo InputFolder = objArgs(0) >> Temp.vbs
    echo ZipFile = objArgs(1) >> Temp.vbs
    echo CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" ^& Chr(5) ^& Chr(6) ^& String(18, vbNullChar) >> Temp.vbs
    echo Set objShell = CreateObject("Shell.Application") >> Temp.vbs
    echo Set source = objShell.NameSpace(InputFolder).Items >> Temp.vbs
    echo objShell.NameSpace(ZipFile).CopyHere(source) >> Temp.vbs
    echo wScript.Sleep 2000 >> Temp.vbs
    del C:\DestinDir\ProgName.exe /f /s
    CScript Temp.vbs  %TEMPDIR%  C:\DestinDir\ProgName.zip
    ren C:\DestinDir\ProgName.zip ProgName.nw
    copy /b nw.exe+ProgName.nw ProgName.exe
    del C:\DestinDir\Temp.vbs /f /s
    del C:\DestinDir\ProgName.nw /f /s
    rmdir C:\temp /s /q
    start ProgName.exe
    

提交回复
热议问题