• Mac OS 的 open 命令 之 No application knows how to open ...


    日常用法

    平常使用最多的是

    # 打开当前目录
    open .
    
    # 打开指定目录(以打开桌面为例)
    open ~/Desktop
    

    进阶用法

    使用指定 app 打开

    # 使用 finder 打开当前目录
    open -a finder .
    

    open -a 解决我的一个问题

    昨天在打包一个 SDK 时,发现打包脚本报错如下:

    重点在第一行里面的 No application knows how to open ... ,打开 SDK 的打包脚本发现打包完最后的工作是自动打开 framework 所在的目录,代码如下:

    # Sets the target folders and the final framework product.
    FMK_NAME=${PROJECT_NAME}
    # Install dir will be the final output to the framework.
    # The following line create it in the root folder of the current project.
    INSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework
    # Working dir will be deleted after the framework creation.
    WRK_DIR=build
    DEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework
    SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework
    # -configuration ${CONFIGURATION}
    # Clean and Building both architectures.
    xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos clean build
    xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator build
    # Cleaning the oldest.
    if [ -d "${INSTALL_DIR}" ]
    then
    rm -rf "${INSTALL_DIR}"
    fi
    mkdir -p "${INSTALL_DIR}"
    cp -R "${DEVICE_DIR}/" "${INSTALL_DIR}/"
    # Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
    lipo -create "${DEVICE_DIR}/${FMK_NAME}" "${SIMULATOR_DIR}/${FMK_NAME}" -output "${INSTALL_DIR}/${FMK_NAME}"
    #rm -r "${INSTALL_DIR}/Info.plist"
    rm -r "${WRK_DIR}"
    open "${INSTALL_DIR}"
    

    因为前面的打包工作全部正常,只是最后一步打开framework的时候出错了,解决方案为,反最后一行改为:

    open -a finder "${INSTALL_DIR}"
    
  • 相关阅读:
    Ubuntu忘记密码后强制修改密码
    搭建Jetbrains家族IDE授权服务器
    C#ComboBox绑定List
    字体包文件过大
    JS通过ActiveX读写ini配置文件
    NodeJS + express访问html、css、JS等静态资源文件
    VueJS搭建简单后台管理系统框架 (二) 模拟Ajax数据请求
    VueJS搭建简单后台管理系统框架(一)环境搭建
    ExtJS4.x Grid 单元格鼠标悬停提示
    IE9下Ajax缓存问题
  • 原文地址:https://www.cnblogs.com/1lin24/p/14275556.html
Copyright © 2020-2023  润新知