3

尝试了很多次和许多解决方案,但都给了我同样的问题。一切正常,应用程序正常工作,没有问题,只是桌面上没有创建的快捷方式。我可以从日志文件“EmulateFileIOPermissionChecks”和消息错误“不支持给定路径的格式”中看到。但不确定这意味着什么。我在使用这个模块“electron-squirrel-startup”时遇到了同样的错误。这是与 SquirrelSetup.log 相关的情况

2018-06-28 17:56:15> Program: Starting Squirrel Updater: --createShortcut C:\Users\name\AppData\Local\myApp\app-0.1.0\myapp.exe
2018-06-28 17:56:15> ApplyReleasesImpl: About to create shortcuts for 
C:\Users\user\AppData\Local\myApp\app-0.1.0\myapp.exe, rootAppDir 
C:\Users\user\AppData\Local\idpAuthElectronApp 2018-06-28 17:56:15> Unhandled exception: System.NotSupportedException: The given path's format is not supported. atSystem.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath) at 
System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess 
access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean 
checkHost)
 at System.IO.Directory.CreateDirectory(String path)

这是我的代码:

var handleSquirrelEvent = function() {

if (process.platform != 'win32') {
  return false;
}

function executeSquirrelCommand(args, done) {
  var updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
  var child = cp.spawn(updateDotExe, args, { detached: true });

  child.on('close', function(code) {
     done();
  });
  };

function install(done) {
  var target = path.resolve(process.execPath);
  executeSquirrelCommand(['--createShortcut', target], done);
};

function uninstall(done) {
  var target = path.resolve(process.execPath);
  executeSquirrelCommand(["--removeShortcut", target], done);
};

var squirrelEvent = process.argv[1];

switch (squirrelEvent) {

  case '--squirrel-install':

     install(app.quit);

     return true;

  case '--squirrel-updated':

     install(app.quit);

     return true;

  case '--squirrel-obsolete':

     app.quit();

     return true;

  case '--squirrel-uninstall':
     uninstall(app.quit);
     return true;
}
 return false;
};

if (handleSquirrelEvent()) {
 return;
}
4

0 回答 0