@@ -116,7 +116,35 @@ private static void BuildGroupBar(NModdingScreen __instance, Control? modInfoPan
116116 _groupBar . Position = new Vector2 ( 550 , 30 ) ;
117117 _groupBar . Size = new Vector2 ( 400 , 28 ) ;
118118 }
119- _groupBar . Alignment = BoxContainer . AlignmentMode . End ;
119+ _groupBar . Alignment = BoxContainer . AlignmentMode . Begin ;
120+
121+ var portableToggle = new CheckButton { Text = "Portable Mode" } ;
122+ portableToggle . ButtonPressed = System . IO . File . Exists ( ProfileManager . PortableConfigPath ) ;
123+ portableToggle . Toggled += ( isToggled ) => {
124+ if ( isToggled ) {
125+ try {
126+ if ( System . IO . File . Exists ( ProfileManager . SavePath ) && ProfileManager . SavePath != ProfileManager . PortableConfigPath )
127+ System . IO . File . Copy ( ProfileManager . SavePath , ProfileManager . PortableConfigPath , true ) ;
128+ else
129+ ProfileManager . SaveProfiles ( ) ;
130+ } catch ( System . Exception ex ) { ProfileManager . ModLogger . Error ( "Failed to enable portable mode: " + ex ) ; }
131+ } else {
132+ try {
133+ string userPath = UserDataPathProvider . GetAccountScopedBasePath ( "mod_data/BetterModMenu" ) ;
134+ string absolutePath = Godot . ProjectSettings . GlobalizePath ( userPath ) ;
135+ if ( ! System . IO . Directory . Exists ( absolutePath ) ) System . IO . Directory . CreateDirectory ( absolutePath ) ;
136+ string target = System . IO . Path . Combine ( absolutePath , "mod_profiles.json" ) ;
137+
138+ if ( System . IO . File . Exists ( ProfileManager . PortableConfigPath ) )
139+ System . IO . File . Copy ( ProfileManager . PortableConfigPath , target , true ) ;
140+
141+ System . IO . File . Delete ( ProfileManager . PortableConfigPath ) ;
142+ } catch ( System . Exception ex ) { ProfileManager . ModLogger . Error ( "Failed to disable portable mode: " + ex ) ; }
143+ }
144+ } ;
145+ _groupBar . AddChild ( portableToggle ) ;
146+
147+ _groupBar . AddChild ( new Control { SizeFlagsHorizontal = Control . SizeFlags . ExpandFill } ) ;
120148
121149 var groupLabel = new Label { Text = "Group:" } ;
122150 _groupBar . AddChild ( groupLabel ) ;
@@ -285,14 +313,20 @@ private static void BuildGroupHeaders(Control container, Dictionary<string, List
285313 renameBtn . Pressed += ( ) => RenameGroup ( grpName ) ;
286314 header . AddChild ( renameBtn ) ;
287315
316+ header . AddChild ( new Control { CustomMinimumSize = new Vector2 ( 10 , 0 ) } ) ;
317+
288318 var upBtn = new Button { Text = "^" } ;
289319 upBtn . Pressed += ( ) => MoveGroup ( grpName , - 1 ) ;
290320 header . AddChild ( upBtn ) ;
291321
322+ header . AddChild ( new Control { CustomMinimumSize = new Vector2 ( 10 , 0 ) } ) ;
323+
292324 var downBtn = new Button { Text = "v" } ;
293325 downBtn . Pressed += ( ) => MoveGroup ( grpName , 1 ) ;
294326 header . AddChild ( downBtn ) ;
295327
328+ header . AddChild ( new Control { CustomMinimumSize = new Vector2 ( 10 , 0 ) } ) ;
329+
296330 var deleteBtn = new Button { Text = "Del" } ;
297331 deleteBtn . Pressed += ( ) => {
298332 ProfileManager . CustomGroups . Remove ( grpName ) ;
0 commit comments