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

Problem with Windows File Association & reading process.argv for opened file #3142

Closed
warrenbuckley opened this issue Jul 20, 2018 · 2 comments

Comments

@warrenbuckley
Copy link

Issue

  • I use npmrun dist` to get electron-builder to build my NSI installer
  • Install the app
  • File associations all works fine
  • Double click a .db file to get electron app to open
  • In my index.html I have done an inline script to read out process.argv with <script>document.write(process.argv)</script>
  • Example output (nothing in here suggests file was opened)
C:\Users\warre\AppData\Local\Programs\nucache.explorer.client\NuCache Explorer.exe,--type=renderer,--no-sandbox,--service-pipe-token=367FFCACF3CC5B851343F29AEE147251,--lang=en-US,--app-path=C:\Users\warre\AppData\Local\Programs\nucache.explorer.client\resources\app.asar,--node-integration=true,--webview-tag=true,--no-sandbox,--context-id=2,--enable-pinch,--device-scale-factor=1,--num-raster-threads=4,--enable-main-frame-before-activation,--content-image-texture-target=0,0,3553;0,1,3553;0,2,3553;0,3,3553;0,4,3553;0,5,3553;0,6,3553;0,7,3553;0,8,3553;0,9,3553;0,10,3553;0,11,3553;0,12,3553;0,13,3553;0,14,3553;0,15,3553;0,16,3553;0,17,3553;1,0,3553;1,1,3553;1,2,3553;1,3,3553;1,4,3553;1,5,3553;1,6,3553;1,7,3553;1,8,3553;1,9,3553;1,10,3553;1,11,3553;1,12,3553;1,13,3553;1,14,3553;1,15,3553;1,16,3553;1,17,3553;2,0,3553;2,1,3553;2,2,3553;2,3,3553;2,4,3553;2,5,3553;2,6,3553;2,7,3553;2,8,3553;2,9,3553;2,10,3553;2,11,3553;2,12,3553;2,13,3553;2,14,3553;2,15,3553;2,16,3553;2,17,3553;3,0,3553;3,1,3553;3,2,3553;3,3,3553;3,4,3553;3,5,3553;3,6,3553;3,7,3553;3,8,3553;3,9,3553;3,10,3553;3,11,3553;3,12,3553;3,13,3553;3,14,3553;3,15,3553;3,16,3553;3,17,3553;4,0,3553;4,1,3553;4,2,3553;4,3,3553;4,4,3553;4,5,3553;4,6,3553;4,7,3553;4,8,3553;4,9,3553;4,10,3553;4,11,3553;4,12,3553;4,13,3553;4,14,3553;4,15,3553;4,16,3553;4,17,3553,--enable-gpu-async-worker-context,--service-request-channel-token=367FFCACF3CC5B851343F29AEE147251,--renderer-client-id=4,--mojo-platform-channel-handle=2032,/prefetch:1

Version & Info

  • Version:
    "electron-builder": "^20.23.1"
    "electron-updater": "^3.0.3"

  • Target:
    Windows - NSI

  • Package JSON with build config

{
  "name": "nucache.explorer.client",
  "productName": "NuCache Explorer",
  "version": "1.0.0",
  "description": "An electron application to read Umbraco V8+ NuCache binary files",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "publish": "electron-builder --publish onTagOrDraft"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/warrenbuckley/Nucache.Explorer.git"
  },
  "keywords": [
    "umbraco",
    "umbraco-v8",
    "nucache",
    "electron",
    "electron-app"
  ],
  "author": "Warren Buckley",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/warrenbuckley/Nucache.Explorer/issues"
  },
  "homepage": "https://github.com/warrenbuckley/Nucache.Explorer#readme",
  "devDependencies": {
    "electron": "^2.0.5",
    "electron-builder": "^20.23.1"
  },
  "dependencies": {
    "codemirror": "^5.39.0",
    "electron-is-dev": "^0.3.0",
    "electron-log": "^2.2.16",
    "electron-reload": "^1.2.5",
    "electron-updater": "^3.0.3",
    "lodash": "^4.17.10",
    "node-fetch": "^2.1.2",
    "vue-codemirror": "^4.0.5"
  },
  "build": {
    "appId": "nucache.explorer",
    "productName": "NuCache Explorer",
    "extraResources": {
      "from": "../NuCache.Explorer.Server/bin/debug/",
      "to": "NuCache.Explorer.Server/bin/debug/",
      "filter": [
        "**/*"
      ]
    },
    "win": {
      "target": [
        "nsis"
      ]
    },
    "nsis": {
      "deleteAppDataOnUninstall": true,
      "createDesktopShortcut": true,
      "createStartMenuShortcut": true,
      "shortcutName": "NuCache Explorer",
      "artifactName": "NuCache.Explorer.Setup.${version}.${ext}",
      "uninstallDisplayName": "NuCache Explorer"
    },
    "fileAssociations": [
      {
        "name": "NuCache Explorer",
        "description": "NuCache Explorer File from Umbraco V8+",
        "ext": [
          "db"
        ]
      }
    ],
    "protocols": [
      {
        "name": "NuCache Explorer File URL",
        "schemes": [
          "nucache"
        ]
      }
    ]
  }
}
@warrenbuckley
Copy link
Author

This was a an issue of my own and nothing to do with the builder. I had required ChildProcess but called it process, a silly error on my part.

@hz0324
Copy link

hz0324 commented Nov 18, 2019

@warrenbuckley Hi, warren. I am working on a project that needs to asscoiate certain file type to Electron app as you did here. Your post have helped me alot.

But I ran into a problem, can you help me?
How did you get the filepath when the electron app started due to double click on the file?

Using your method, I can see the process.argv,but nothing related to file path.
QQ浏览器截图20191118165419

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

No branches or pull requests

2 participants