Skip to content
New issue

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

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

Already on GitHub? # to your account

[Enhancement] 支持MacOS平台 #7

Closed
ethanjtch opened this issue May 14, 2023 · 24 comments
Closed

[Enhancement] 支持MacOS平台 #7

ethanjtch opened this issue May 14, 2023 · 24 comments
Labels
enhancement New feature or request

Comments

@ethanjtch
Copy link

你好,

非常感谢你开发了AlistHelper,为我们不懂技术语言且没有私人服务器的人提供了巨大的便利。

希望可以开发Mac端,我就可以设置为自启动了。

再次感谢!

Ethan

@justincnn
Copy link

同期待mac版

@Xmarmalade Xmarmalade added enhancement New feature or request help wanted Extra attention is needed labels May 14, 2023
@Xmarmalade Xmarmalade changed the title 申请支持Mac端 [Enhancement] 支持MacOS平台 May 14, 2023
@Xmarmalade
Copy link
Owner

你好,由于我没有mac设备,所以对macOS的开发调试较为困难,但是代码基本是兼容的

@Mrered
Copy link

Mrered commented May 16, 2023

同求macOS版本

@Mrered
Copy link

Mrered commented May 16, 2023

写好之后我愿意尝试为其添加Homebrew安装支持

@aLIEz-xue
Copy link

你好,由于我没有mac设备,所以对macOS的开发调试较为困难,但是代码基本是兼容的

大佬,有打包的教程吗,我想在我的M1上打包个DMG安装包

@aLIEz-xue
Copy link

你好,由于我没有mac设备,所以对macOS的开发调试较为困难,但是代码基本是兼容的

程序判断alist程序是写死的吗,必须有alist.exe才能识别出来是吗,Mac上的alist没有后缀名,好像程序判断不出来
image

@Xmarmalade
Copy link
Owner

你好,由于我没有mac设备,所以对macOS的开发调试较为困难,但是代码基本是兼容的

程序判断alist程序是写死的吗,必须有alist.exe才能识别出来是吗,Mac上的alist没有后缀名,好像程序判断不出来 image

你好,我推送了一个新提交,增加了对系统环境的判断,请验证一下是否可行!

@aLIEz-xue
Copy link

你好,由于我没有mac设备,所以对macOS的开发调试较为困难,但是代码基本是兼容的

程序判断alist程序是写死的吗,必须有alist.exe才能识别出来是吗,Mac上的alist没有后缀名,好像程序判断不出来 image

你好,我推送了一个新提交,增加了对系统环境的判断,请验证一下是否可行!

可行,添加alist成功了,但是启动不了
image
下面这是直接用alist启动的
image

@Xmarmalade
Copy link
Owner

Xmarmalade commented May 21, 2023

你试试把lib\provider\alist_provider.dart中的startAlist()(Line48)其中的代码进行修改为

// other code (Line 58)
    if (Platform.isWindows) {
      process = await Process.start(
        '$workingDirectory\\alist.exe',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    } else {
      process = await Process.start(
        '$workingDirectory/alist',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    }
// other code

看看能否启动

@aLIEz-xue
Copy link

你试试把lib\provider\alist_provider.dart中的startAlist()(Line48)其中的代码进行修改为

// other code (Line 58)
    if (Platform.isWindows) {
      process = await Process.start(
        '$workingDirectory\\alist.exe',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    } else {
      process = await Process.start(
        '$workingDirectory/alist',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    }
// other code

看看能否启动

不行,但是我应该找到原因了,前面读取到的‘/Volumes/Macintosh HD’影响了命令执行
image
image

@Xmarmalade
Copy link
Owner

Xmarmalade commented May 21, 2023

似乎是权限问题,考虑到文档:

授予程序执行权限:
chmod +x alist

试试授予Alist Helper完全磁盘访问权限
加入权限检查,如果没有权限则提醒

    if (Platform.isWindows) {
      process = await Process.start(
        '$workingDirectory\\alist.exe',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    } else {
      if (Platform.isMacOS || Platform.isLinux) {
        var stat = await File('$workingDirectory/alist').stat();
        bool canExecute = (stat.mode & 0x100) != 0;
        if (!canExecute) {
          addOutput('Please run: chmod +x alist');
        }
      }
      process = await Process.start(
        '$workingDirectory/alist',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    }

也有可能是沙盒问题 tekartik/process_run.dart#3
https://pub.dev/documentation/process_run/latest/
移除沙盒还可以让程序自启

@Xmarmalade
Copy link
Owner

不行,但是我应该找到原因了,前面读取到的‘/Volumes/Macintosh HD’影响了命令执行

这个应该不对,导致这个的原因应该是Macintosh HD的空格被系统判定分开了

@aLIEz-xue
Copy link

似乎是权限问题,考虑到文档:

授予程序执行权限:
chmod +x alist

试试授予Alist Helper完全磁盘访问权限 加入权限检查,如果没有权限则提醒

    if (Platform.isWindows) {
      process = await Process.start(
        '$workingDirectory\\alist.exe',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    } else {
      if (Platform.isMacOS || Platform.isLinux) {
        var stat = await File('$workingDirectory/alist').stat();
        bool canExecute = (stat.mode & 0x100) != 0;
        if (!canExecute) {
          addOutput('Please run: chmod +x alist');
        }
      }
      process = await Process.start(
        '$workingDirectory/alist',
        alistArgs,
        workingDirectory: workingDirectory,
        environment: envVars,
      );
    }

也有可能是沙盒问题 tekartik/process_run.dart#3 https://pub.dev/documentation/process_run/latest/ 移除沙盒还可以让程序自启

可以了,关闭沙盒就行了,谢谢大佬,我再看看有没有其他问题,还有就是怎么打包成 dmg和app呀,我没打包过flutter

@Xmarmalade
Copy link
Owner

flutter build macos
https://docs.flutter.dev/deployment/macos

@ethanjtch
Copy link
Author

已经开始期待了 😁

@aLIEz-xue
Copy link

已经开始期待了 😁

打包成APP测试了几遍,自启动软件和自启动alist都没什么问题,管理员信息、版本信息和检查更新点击会闪退,同时没有最小化菜单栏的功能,关闭alisthelper就直接关闭了(不影响alist),所以某种意义上来说也无所谓。

@Xmarmalade
Copy link
Owner

已经开始期待了 😁

打包成APP测试了几遍,自启动软件和自启动alist都没什么问题,管理员信息、版本信息和检查更新点击会闪退,同时没有最小化菜单栏的功能,关闭alisthelper就直接关闭了(不影响alist),所以某种意义上来说也无所谓。

闪退应该是没改,我一会修一下;系统托盘的问题可以详细描述一下吗

@aLIEz-xue
Copy link

就是alisthelper没有这上面的小图标,类似Windows上面的托盘图标吧,只有程序坞里的图标,点击关闭就是关闭了
image
image

Xmarmalade added a commit that referenced this issue May 22, 2023
disable `quit on close`, disable sandbox mode, fix alist_provider bug, add `hidden at launch` to macos and linux

#7
@Xmarmalade
Copy link
Owner

我推送了一些新代码,其中包含:

  • (macOS) 取消“关闭即退出”
  • (macOS) 禁用沙盒,允许联网
  • 修复了错误的alist进程调用
  • 在开机自启时可以隐藏

请帮我测试一下是否有问题 @aLIEz-xue

@aLIEz-xue
Copy link

我推送了一些新代码,其中包含:

  • (macOS) 取消“关闭即退出”
  • (macOS) 禁用沙盒,允许联网
  • 修复了错误的alist进程调用
  • 在开机自启时可以隐藏

请帮我测试一下是否有问题 @aLIEz-xue

测试了,这几个功能都没有问题,非常nice,管理员信息、版本信息和检查更新等功能也都没问题了,大佬牛呀

@Xmarmalade
Copy link
Owner

我推荐了一些新代码,其中包含:

  • (macOS) 取消“关闭即退出”
  • (macOS) 禁止使用沙盒,允许联网
  • 修复了错误的alist进入程序调整
  • 在开机自启时可以隐藏

请帮我测试一下是否有问题@aLIEz-xue

测试了,这几个功能都没有问题,非常nice,管理员信息、版本信息和检查更新等功能也都没有问题了,大佬牛呀

现在点关闭还会完全退出吗;托盘还是用不了吗

@aLIEz-xue
Copy link

我推荐了一些新代码,其中包含:

  • (macOS) 取消“关闭即退出”
  • (macOS) 禁止使用沙盒,允许联网
  • 修复了错误的alist进入程序调整
  • 在开机自启时可以隐藏

请帮我测试一下是否有问题@aLIEz-xue

测试了,这几个功能都没有问题,非常nice,管理员信息、版本信息和检查更新等功能也都没有问题了,大佬牛呀

现在点关闭还会完全退出吗;托盘还是用不了吗

不会了,关闭后会隐藏到菜单栏里,菜单栏图标可用
image

@Xmarmalade
Copy link
Owner

也就是说目前没有影响到macOS使用的bug了,那我稍后推一下新版本

@Xmarmalade
Copy link
Owner

Xmarmalade commented May 23, 2023

v0.1.0 已发布,暂时关闭此issue。

@Xmarmalade Xmarmalade removed the help wanted Extra attention is needed label May 23, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants