Mac 中快速使用 Android Studio 打开某个目录
1.打开自动操作 app
2.选择快速操作
3.搜索shell
4.编辑脚本
4.0.1 编辑脚本的不选择
-
如果你的
android studio
是独立下载安装的,直接点击Create Command-line launcher
创建一个命令行即可。默认情况下,你现在可以用命令行studio $dir
直接打开一个目录了
-
如果你是用 JetBrains ToolBox 添加 android studio 的,在 setting 中添加 shell 路径就可以了,toolbox 会自动生成 shell 脚本
-
1.打开路径后复制脚本内容就可以了
粘贴,选择类型 /bin/bash
4.0.2 命令行的两个版本
-
zsh shell 版本
命令行有两个版本,一个是我使用的 zsh shell 版本,这个是我自己装的,默认没有。另一个是 bash shell 版本,这个是 mac 系统自带的,如果你没有听说过
zsh
,用这个版本就对了。source ~/.zshrc && studio $1
-
对应 shell 代码
source ~/.bash_profile && studio $1
source ~/.bash_profile
用于设定所有~/.bash_profile
定义的东西,这样才能使用后面的studio
这个命令,如果你直接指定studio
文件所在,就不需要这句。比如直接写/usr/bin/studio $1
就不需要source
。$1
是指第一个参数的意思,这里自动操作会传递目录过来
5.保存安装
填入文件名
6.修改的地方
在设置中搜索快速操作
在 Finder 中显示