diff --git a/lib/synx/xcodeproj_ext/project/object/abstract_object.rb b/lib/synx/xcodeproj_ext/project/object/abstract_object.rb index 9402578..de910de 100644 --- a/lib/synx/xcodeproj_ext/project/object/abstract_object.rb +++ b/lib/synx/xcodeproj_ext/project/object/abstract_object.rb @@ -20,7 +20,13 @@ def work_pathname @work_pathname ||= project.work_root_pathname elsif parent.is_a?(Xcodeproj::Project::Object::PBXVariantGroup) # Localized object, naming is handled differently. - @work_pathname ||= parent.work_pathname + "#{display_name}.lproj" + parent.display_name + # We need to grab the file extension from the path in order to prevent + # .xib and .strings files from being renamed to the .storyboard extension + # of their parent. + file_name = parent.display_name.slice(0..parent.display_name.rindex(".")-1) + file_ext = path.slice(path.rindex(".")..-1) + full_name = file_name + file_ext + @work_pathname ||= parent.work_pathname + "#{display_name}.lproj" + full_name elsif is_a?(Xcodeproj::Project::Object::PBXVariantGroup) # Localized container, has no path of its own. @work_pathname ||= parent.work_pathname diff --git a/spec/dummy/dummy.xcodeproj/project.pbxproj b/spec/dummy/dummy.xcodeproj/project.pbxproj index c9a98e3..4072630 100644 --- a/spec/dummy/dummy.xcodeproj/project.pbxproj +++ b/spec/dummy/dummy.xcodeproj/project.pbxproj @@ -62,7 +62,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 637E22771A5235CE00A08D6A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; + 096523031D4DAF4600713E82 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/View.xib; sourceTree = ""; }; + 096523041D4DAF4600713E82 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Storyboard.storyboard; sourceTree = ""; }; + 096523061D4DAF5500713E82 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/View.strings; sourceTree = ""; }; + 0965230A1D4DAF6B00713E82 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Storyboard.strings; sourceTree = ""; }; 8C2DEB7D191D3F5C003A1F44 /* ManyFiles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManyFiles.h; sourceTree = ""; }; 8C2DEB7E191D3F5C003A1F44 /* ManyFiles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManyFiles.m; sourceTree = ""; }; 8C2DEB80191D3F68003A1F44 /* Wow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wow.h; sourceTree = ""; }; @@ -90,7 +93,6 @@ 8C848C65190DB9B300E9727B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 8C848C67190DB9B300E9727B /* dummyTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = dummyTests.m; sourceTree = ""; }; 8CADDD3A19354F120076033B /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = ""; }; - 8CD2ABF219558D7800341C58 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; 8CDA046319374F35004435A1 /* data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = data.json; path = FolderWithGroupNotLinked/data.json; sourceTree = ""; }; 8CE2DA1D19220F7B00D06F5E /* dummyTests-prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "dummyTests-prefix.pch"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -133,8 +135,6 @@ 8C2DEB83191D3F9E003A1F44 /* GroupThatDoubleReferencesFile */ = { isa = PBXGroup; children = ( - 8C2DEB7D191D3F5C003A1F44 /* ManyFiles.h */, - 8C2DEB7E191D3F5C003A1F44 /* ManyFiles.m */, ); name = GroupThatDoubleReferencesFile; sourceTree = ""; @@ -208,8 +208,9 @@ 8C848C4E190DB9B300E9727B /* Supporting Files */ = { isa = PBXGroup; children = ( - 8CD2ABF119558D7800341C58 /* Localizable.strings */, 8C848C4F190DB9B300E9727B /* dummy-Prefix.pch */, + 096522FE1D4DAF2D00713E82 /* View.xib */, + 096523001D4DAF3100713E82 /* Storyboard.storyboard */, ); name = "Supporting Files"; sourceTree = ""; @@ -311,6 +312,7 @@ knownRegions = ( en, de, + Base, ); mainGroup = 8C848C3F190DB9B300E9727B; productRefGroup = 8C848C49190DB9B300E9727B /* Products */; @@ -370,22 +372,30 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 8C848C64190DB9B300E9727B /* InfoPlist.strings */ = { + 096522FE1D4DAF2D00713E82 /* View.xib */ = { isa = PBXVariantGroup; children = ( - 8C848C65190DB9B300E9727B /* en */, + 096523031D4DAF4600713E82 /* Base */, + 096523061D4DAF5500713E82 /* de */, ); - name = InfoPlist.strings; + name = View.xib; sourceTree = ""; }; - 8CD2ABF119558D7800341C58 /* Localizable.strings */ = { + 096523001D4DAF3100713E82 /* Storyboard.storyboard */ = { isa = PBXVariantGroup; children = ( - 8CD2ABF219558D7800341C58 /* en */, - 637E22771A5235CE00A08D6A /* de */, + 096523041D4DAF4600713E82 /* Base */, + 0965230A1D4DAF6B00713E82 /* de */, ); - name = Localizable.strings; - path = en.lproj; + name = Storyboard.storyboard; + sourceTree = ""; + }; + 8C848C64190DB9B300E9727B /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 8C848C65190DB9B300E9727B /* en */, + ); + name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ diff --git a/spec/dummy/dummy/Base.lproj/Storyboard.storyboard b/spec/dummy/dummy/Base.lproj/Storyboard.storyboard new file mode 100644 index 0000000..673e0f7 --- /dev/null +++ b/spec/dummy/dummy/Base.lproj/Storyboard.storyboard @@ -0,0 +1,7 @@ + + + + + + + diff --git a/spec/dummy/dummy/Base.lproj/View.xib b/spec/dummy/dummy/Base.lproj/View.xib new file mode 100644 index 0000000..5708860 --- /dev/null +++ b/spec/dummy/dummy/Base.lproj/View.xib @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/spec/dummy/dummy/de.lproj/Storyboard.strings b/spec/dummy/dummy/de.lproj/Storyboard.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/dummy/de.lproj/Storyboard.strings @@ -0,0 +1 @@ + diff --git a/spec/dummy/dummy/de.lproj/View.strings b/spec/dummy/dummy/de.lproj/View.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/spec/dummy/dummy/de.lproj/View.strings @@ -0,0 +1 @@ + diff --git a/spec/dummy/dummy/en.lproj/Localizable.strings b/spec/dummy/dummy/en.lproj/Localizable.strings deleted file mode 100644 index d9c2519..0000000 --- a/spec/dummy/dummy/en.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - dummy - - Created by Mark Larsen on 6/21/14. - Copyright (c) 2014 marklarr. All rights reserved. -*/ - -"Greeting" = "Hello"; \ No newline at end of file diff --git a/spec/dummy/dummy/en.lproj/de.lproj/Localizable.strings b/spec/dummy/dummy/en.lproj/de.lproj/Localizable.strings deleted file mode 100644 index 0d865e2..0000000 --- a/spec/dummy/dummy/en.lproj/de.lproj/Localizable.strings +++ /dev/null @@ -1,9 +0,0 @@ -/* - Localizable.strings - dummy - - Created by Mark Larsen on 6/21/14. - Copyright (c) 2014 marklarr. All rights reserved. -*/ - -"Greeting" = "Guten Tag"; \ No newline at end of file diff --git a/spec/synx/expected_file_structure.yml b/spec/synx/expected_file_structure.yml index f1ccb98..5da203d 100644 --- a/spec/synx/expected_file_structure.yml +++ b/spec/synx/expected_file_structure.yml @@ -28,10 +28,12 @@ dummy: ManyFiles.m: Supporting Files: dummy-Prefix.pch: - en.lproj: - Localizable.strings: + Base.lproj: + Storyboard.storyboard: + View.xib: de.lproj: - Localizable.strings: + Storyboard.strings: + View.strings: dummy.h: dummy.m: FileNotInXcodeProj.h: diff --git a/spec/synx/expected_group_structure.yml b/spec/synx/expected_group_structure.yml index 0f291db..9bbd98a 100644 --- a/spec/synx/expected_group_structure.yml +++ b/spec/synx/expected_group_structure.yml @@ -29,7 +29,12 @@ dummy: Wow.h: Wow.m: Supporting Files: - Localizable.strings: + Storyboard.storyboard: + Storyboard.storyboard: + Storyboard.strings: + View.xib: + View.xib: + View.strings: dummy-Prefix.pch: dummy.h: dummy.m: