@@ -20,7 +20,14 @@ internal class BuildProfileDataSource : IDisposable
2020
2121 const string k_AssetFolderPath = "Assets/Settings/Build Profiles" ;
2222
23- static string GetNewProfileName ( string displayName ) => $ "{ k_AssetFolderPath } /{ displayName } .asset";
23+ static string GetDefaultNewProfilePath ( string platformDisplayName ) =>
24+ $ "{ k_AssetFolderPath } /New { platformDisplayName } Profile.asset";
25+
26+ static string GetDefaultNewProfilePath ( GUID platformGuid )
27+ {
28+ var platformDisplayName = BuildProfileModuleUtil . GetClassicPlatformDisplayName ( platformGuid . ToString ( ) ) ;
29+ return GetDefaultNewProfilePath ( platformDisplayName ) ;
30+ }
2431
2532 internal BuildProfileDataSource ( BuildProfileWindow window )
2633 {
@@ -86,14 +93,13 @@ internal List<BuildProfile> DuplicateProfiles(List<BuildProfile> profilesToDupli
8693 }
8794
8895 /// <summary>
89- /// Create a custom build profile asset, making sure to create the folders
90- /// if needed
96+ /// Create a new custom build profile asset with the default name.
97+ /// Ensure that custom build profile folders is created if it doesn't already exist.
9198 /// </summary>
92- internal static void CreateAsset ( string platformId , string displayName )
99+ internal static void CreateNewAsset ( string platformId , string platformDisplayName )
93100 {
94- CheckCreateCustomBuildProfileFolders ( ) ;
95-
96- BuildProfile . CreateInstance ( platformId , GetNewProfileName ( displayName ) ) ;
101+ EnsureCustomBuildProfileFolderExists ( ) ;
102+ BuildProfile . CreateInstance ( platformId , GetDefaultNewProfilePath ( platformDisplayName ) ) ;
97103 }
98104
99105 /// <summary>
@@ -105,7 +111,7 @@ internal static BuildProfile DuplicateAsset(BuildProfile buildProfile, bool isCl
105111 if ( buildProfile == null )
106112 return null ;
107113
108- string path = isClassic ? GetDuplicatedBuildProfilePathForClassic ( buildProfile ) : AssetDatabase . GetAssetPath ( buildProfile ) ;
114+ string path = isClassic ? GetDefaultNewProfilePath ( new GUID ( buildProfile . platformId ) ) : AssetDatabase . GetAssetPath ( buildProfile ) ;
109115 if ( string . IsNullOrEmpty ( path ) )
110116 return null ;
111117
@@ -116,7 +122,7 @@ internal static BuildProfile DuplicateAsset(BuildProfile buildProfile, bool isCl
116122 if ( isClassic )
117123 duplicatedProfile . scenes = EditorBuildSettings . GetEditorBuildSettingsSceneIgnoreProfile ( ) ;
118124
119- CheckCreateCustomBuildProfileFolders ( ) ;
125+ EnsureCustomBuildProfileFolderExists ( ) ;
120126
121127 string uniqueFilePath = AssetDatabase . GenerateUniqueAssetPath ( path ) ;
122128 AssetDatabase . CreateAsset ( duplicatedProfile , uniqueFilePath ) ;
@@ -301,13 +307,7 @@ static string ReplaceFileNameInPath(string originalPath, string newName)
301307 return Path . Combine ( directory , $ "{ newName } { extension } ") ;
302308 }
303309
304- static string GetDuplicatedBuildProfilePathForClassic ( BuildProfile buildProfile )
305- {
306- string name = BuildProfileModuleUtil . GetClassicPlatformDisplayName ( buildProfile . platformId ) ;
307- return Path . Combine ( k_AssetFolderPath , $ "{ name } .asset") ;
308- }
309-
310- static void CheckCreateCustomBuildProfileFolders ( )
310+ static void EnsureCustomBuildProfileFolderExists ( )
311311 {
312312 if ( ! AssetDatabase . IsValidFolder ( "Assets/Settings" ) )
313313 AssetDatabase . CreateFolder ( "Assets" , "Settings" ) ;
0 commit comments