zoukankan      html  css  js  c++  java
  • 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}"
    
  • 相关阅读:
    C++中函数模板template的使用
    C++中模板template和类class的结合使用
    Python中shuffle函数
    Python中利用tkinter模块构建图形用户界面GUI
    Python中怎样初始化一个类类class?
    Python中字典的has_key方法在3.4版本中改为in
    Python中怎样对数据集整体进行映射转换类型
    matlab中怎样对矩阵的某一列进行排序而使得其他列对应移动??
    Python中怎样使用shape计算矩阵的行和列
    27.反射2.md
  • 原文地址:https://www.cnblogs.com/1lin24/p/14275556.html
Copyright © 2011-2022 走看看