@@ -20,7 +20,14 @@ internal class BuildProfileDataSource : IDisposable
20
20
21
21
const string k_AssetFolderPath = "Assets/Settings/Build Profiles" ;
22
22
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
+ }
24
31
25
32
internal BuildProfileDataSource ( BuildProfileWindow window )
26
33
{
@@ -86,14 +93,13 @@ internal List<BuildProfile> DuplicateProfiles(List<BuildProfile> profilesToDupli
86
93
}
87
94
88
95
/// <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.
91
98
/// </summary>
92
- internal static void CreateAsset ( string platformId , string displayName )
99
+ internal static void CreateNewAsset ( string platformId , string platformDisplayName )
93
100
{
94
- CheckCreateCustomBuildProfileFolders ( ) ;
95
-
96
- BuildProfile . CreateInstance ( platformId , GetNewProfileName ( displayName ) ) ;
101
+ EnsureCustomBuildProfileFolderExists ( ) ;
102
+ BuildProfile . CreateInstance ( platformId , GetDefaultNewProfilePath ( platformDisplayName ) ) ;
97
103
}
98
104
99
105
/// <summary>
@@ -105,7 +111,7 @@ internal static BuildProfile DuplicateAsset(BuildProfile buildProfile, bool isCl
105
111
if ( buildProfile == null )
106
112
return null ;
107
113
108
- string path = isClassic ? GetDuplicatedBuildProfilePathForClassic ( buildProfile ) : AssetDatabase . GetAssetPath ( buildProfile ) ;
114
+ string path = isClassic ? GetDefaultNewProfilePath ( new GUID ( buildProfile . platformId ) ) : AssetDatabase . GetAssetPath ( buildProfile ) ;
109
115
if ( string . IsNullOrEmpty ( path ) )
110
116
return null ;
111
117
@@ -116,7 +122,7 @@ internal static BuildProfile DuplicateAsset(BuildProfile buildProfile, bool isCl
116
122
if ( isClassic )
117
123
duplicatedProfile . scenes = EditorBuildSettings . GetEditorBuildSettingsSceneIgnoreProfile ( ) ;
118
124
119
- CheckCreateCustomBuildProfileFolders ( ) ;
125
+ EnsureCustomBuildProfileFolderExists ( ) ;
120
126
121
127
string uniqueFilePath = AssetDatabase . GenerateUniqueAssetPath ( path ) ;
122
128
AssetDatabase . CreateAsset ( duplicatedProfile , uniqueFilePath ) ;
@@ -301,13 +307,7 @@ static string ReplaceFileNameInPath(string originalPath, string newName)
301
307
return Path . Combine ( directory , $ "{ newName } { extension } ") ;
302
308
}
303
309
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 ( )
311
311
{
312
312
if ( ! AssetDatabase . IsValidFolder ( "Assets/Settings" ) )
313
313
AssetDatabase . CreateFolder ( "Assets" , "Settings" ) ;
0 commit comments