Skip to content

Commit

Permalink
Fix bug change the Default Distro Location not working (#209)
Browse files Browse the repository at this point in the history
* Fix bug change the Default Distro Location not working

* Remove scripts
  • Loading branch information
joutvhu authored Aug 15, 2023
1 parent 55195a4 commit a100e2a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/api/dialogs_create_dialog/createInstance.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h2><span>Implementation</span></h2>
statusMsg(&#39;creatinginstance-text&#39;.i18n(), loading: true);
String location = locationController.text;
if (location == &#39;&#39;) {
location = prefs.getString(&quot;SaveLocation&quot;) ?? defaultPath;
location = prefs.getString(&quot;DistroPath&quot;) ?? defaultPath;
location += &#39;&#47;$name&#39;;
}
var result = await api.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ <h2><span>Implementation</span></h2>
if (_settings[&#39;Default Distro Location&#39;]!
.text
.isNotEmpty) {
prefs.setString(&quot;SaveLocation&quot;,
prefs.setString(&quot;DistroPath&quot;,
_settings[&#39;Default Distro Location&#39;]!.text);
}
String config = &#39;&#39;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ <h2><span>Implementation</span></h2>
suffix: IconButton(
icon: const Icon(FluentIcons.open_folder_horizontal, size: 15.0),
onPressed: () async {
String? path = await FilePicker.platform.getDirectoryPath();
String? path = await FilePicker.platform.getDirectoryPath(
initialDirectory: prefs.getString(&quot;DistroPath&quot;) ?? defaultPath,
);
if (path != null &amp;&amp;
_settings[&#39;Default Distro Location&#39;] != null) {
_settings[&#39;Default Distro Location&#39;]!.text = path;
Expand All @@ -85,7 +87,7 @@ <h2><span>Implementation</span></h2>
}
},
),
placeholder: prefs.getString(&quot;SaveLocation&quot;) ?? defaultPath),
placeholder: prefs.getString(&quot;DistroPath&quot;) ?? defaultPath),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down
2 changes: 1 addition & 1 deletion lib/dialogs/create_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Future<void> createInstance(
Notify.message('creatinginstance-text'.i18n(), loading: true);
String location = locationController.text;
if (location == '') {
location = prefs.getString("SaveLocation") ?? defaultPath;
location = prefs.getString("DistroPath") ?? defaultPath;
location += '/$name';
}

Expand Down
8 changes: 5 additions & 3 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class SettingsPageState extends State<SettingsPage> {
// Distro location setting
if (_settings['Default Distro Location']!.text.isNotEmpty) {
prefs.setString(
"SaveLocation", _settings['Default Distro Location']!.text);
"DistroPath", _settings['Default Distro Location']!.text);
}
_settings.forEach((key, value) {
if (key != 'Default Distro Location' && value.text.isNotEmpty) {
Expand All @@ -189,7 +189,9 @@ class SettingsPageState extends State<SettingsPage> {
suffix: IconButton(
icon: const Icon(FluentIcons.open_folder_horizontal, size: 15.0),
onPressed: () async {
String? path = await FilePicker.platform.getDirectoryPath();
String? path = await FilePicker.platform.getDirectoryPath(
initialDirectory: prefs.getString("DistroPath") ?? defaultPath,
);
if (path != null &&
_settings['Default Distro Location'] != null) {
_settings['Default Distro Location']!.text = path;
Expand All @@ -198,7 +200,7 @@ class SettingsPageState extends State<SettingsPage> {
}
},
),
placeholder: prefs.getString("SaveLocation") ?? defaultPath),
placeholder: prefs.getString("DistroPath") ?? defaultPath),
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: const EdgeInsets.all(8.0),
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: wsl2distromanager
description: A GUI to quickly manage your WSL instances.

publish_to: "none"
version: 1.8.6 # Current version

version: 1.8.7 # Current version

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.17.0 <4.0.0"

dependencies:
flutter:
Expand Down

0 comments on commit a100e2a

Please sign in to comment.