Ejemplo n.º 1
0
def add_permission(file_path, permission_name):
    full_permission_name = '  <uses-permission android:name="{0}" />'.format(
        permission_name)
    print "\n* Adding permission {0}".format(full_permission_name)
    os_helper.insert_before(
        file_path,
        '<uses-feature android:name="android.hardware.touchscreen" />',
        [full_permission_name])
Ejemplo n.º 2
0
def add_resource(pbx_proj_path, pbx_build_file_code, pbx_file_reference_code, pbx_group_code, pbx_resource_code):
  resource_to_add = re.search("/\* (.*) in Resources \*/", pbx_build_file_code[0])
  if not resource_to_add:
    print "Adding Resource stopped because we didn't find the name in {0}".format(pbx_build_file_code[0])
    return

  resource_name = resource_to_add.group(1)
  print "\nAdding Resource {0}".format(resource_name)

  if(os_helper.contains(pbx_proj_path, resource_name)):
    print "{0} already included".format(resource_name)
    return

  os_helper.insert_after(pbx_proj_path, "/* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = ", pbx_build_file_code)
  os_helper.insert_after(pbx_proj_path, '/* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>";', pbx_file_reference_code)
  os_helper.insert_before(pbx_proj_path, "/* SystemConfiguration.framework */,", pbx_group_code)
  os_helper.insert_after_regex(pbx_proj_path, "\t*.* /\* Icon\.png in Resources \*/,", pbx_resource_code)
Ejemplo n.º 3
0
def add_to_plist(plist_path, code):
  print "\nAdding code to plist"
  os_helper.insert_before(plist_path, "</dict>", code)
  
  print "Code Added :]"
Ejemplo n.º 4
0
def add_method(file_path, method_lines):
  print "\nAdding method {0}".format(method_lines[0])
  os_helper.insert_before(file_path, "@end", method_lines)
Ejemplo n.º 5
0
def add_into_classes(pbx_proj_path, pbx_build_file_code, pbx_file_reference_code, pbx_group_code, group_folder_reference, pbx_source_build_phase_code):
  os_helper.insert_after(pbx_proj_path, "/* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = ", pbx_build_file_code)
  os_helper.insert_after(pbx_proj_path, '/* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>";', pbx_file_reference_code)
  os_helper.insert_before(pbx_proj_path, "/* UI */ = {", pbx_group_code)
  os_helper.insert_before(pbx_proj_path, "/* Unity */,", group_folder_reference)
  os_helper.insert_before(pbx_proj_path, "/* DisplayManager.mm in Sources */,", pbx_source_build_phase_code)
Ejemplo n.º 6
0
def create_import(file_to_import, file_path, extension="mm"):
  print "\nImport {0} into {1}".format(file_to_import, file_path)
  insert_before_keyword	= "@implementation" if extension == "mm" else "@interface"
  os_helper.insert_before(file_path, insert_before_keyword, ['#import \"{0}\"'.format(file_to_import)])
Ejemplo n.º 7
0
def add_string_resource(file_path, string_key, string_value):
    print "\n* Adding string resource into {0}".format(file_path)
    os_helper.insert_before(
        os.path.join(file_path, "res/values/strings.xml"), "</resources>",
        ['<string name="{0}">{1}</string>'.format(string_key, string_value)])
Ejemplo n.º 8
0
def add_activity(file_path, codeList):
    print "\n* Adding activity into {0}".format(file_path)
    os_helper.insert_before(file_path, "</application>", codeList)
Ejemplo n.º 9
0
def add_string_resource(file_path, string_key, string_value):
  print "\n* Adding string resource into {0}".format(file_path)
  os_helper.insert_before(os.path.join(file_path, "res/values/strings.xml"), "</resources>", ['<string name="{0}">{1}</string>'.format(string_key, string_value)])
Ejemplo n.º 10
0
def add_permission(file_path, permission_name):
  full_permission_name = '  <uses-permission android:name="{0}" />'.format(permission_name)
  print "\n* Adding permission {0}".format(full_permission_name)
  os_helper.insert_before(file_path, '<uses-feature android:name="android.hardware.touchscreen" />', [full_permission_name])
Ejemplo n.º 11
0
def add_activity(file_path, codeList):
  print "\n* Adding activity into {0}".format(file_path)
  os_helper.insert_before(file_path, "</application>", codeList)