make_locale_dirs.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. # usage: make_locale_dirs.sh locale_dir [...]
  6. #
  7. # This script creates the Resources directory for the bundle being built by
  8. # the Xcode target that calls it if the directory does not yet exist. It then
  9. # changes to that directory and creates subdirectories for each locale_dir
  10. # passed on the command line.
  11. #
  12. # This script is intended to create empty locale directories (.lproj) in a
  13. # Cocoa .app bundle. The presence of these empty directories is sufficient to
  14. # convince Cocoa that the application supports the named localization, even if
  15. # an InfoPlist.strings file is not provided. Chrome uses these empty locale
  16. # directoires for its helper executable bundles, which do not otherwise
  17. # require any direct Cocoa locale support.
  18. set -eu
  19. if [[ ${#} -eq 0 ]]; then
  20. echo "usage: ${0} locale_dir [...]" >& 2
  21. exit 1
  22. fi
  23. RESOURCES_DIR="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  24. if [[ ! -d "${RESOURCES_DIR}" ]]; then
  25. mkdir "${RESOURCES_DIR}"
  26. fi
  27. cd "${RESOURCES_DIR}"
  28. for dir in "${@}"; do
  29. if [[ ! -d "${dir}" ]]; then
  30. mkdir "${dir}"
  31. fi
  32. done