Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
);

try {
_initFromProjectDir(projectDir!);
await _initFromProjectDir(projectDir!);

Check warning on line 122 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L122

Added line #L122 was not covered by tests
// Break from the loop if we've successfully loaded the project
break;
} catch (e, stack) {
Expand Down Expand Up @@ -276,7 +276,7 @@
IconButton(
icon: const Icon(Icons.open_in_new_rounded, size: 20),
tooltip: 'Open Project',
onPressed: () => _openProjectDialog(this.context),
onPressed: () => _openProjectDialog(),

Check warning on line 279 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L279

Added line #L279 was not covered by tests
),
],
),
Expand Down Expand Up @@ -677,16 +677,22 @@
});
}

void _openProjectDialog(BuildContext context) async {
void _openProjectDialog() async {

Check warning on line 680 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L680

Added line #L680 was not covered by tests
String initialDirectory = _projectDir?.path ?? fs.currentDirectory.path;
String? projectFolder = await getDirectoryPath(
confirmButtonText: 'Open Project', initialDirectory: initialDirectory);
if (projectFolder != null) {
_initFromProjectDir(projectFolder);
try {
await _initFromProjectDir(projectFolder);

Check warning on line 686 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L686

Added line #L686 was not covered by tests
} catch (e, stack) {
Log.error('Failed to initialize from project directory', e, stack);

Check warning on line 688 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L688

Added line #L688 was not covered by tests
// Try again
_openProjectDialog();

Check warning on line 690 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L690

Added line #L690 was not covered by tests
}
}
}

void _initFromProjectDir(String projectDir) async {
Future<void> _initFromProjectDir(String projectDir) async {

Check warning on line 695 in lib/pages/home_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/home_page.dart#L695

Added line #L695 was not covered by tests
widget.prefs.setString(PrefsKeys.currentProjectDir, projectDir);

if (Platform.isMacOS) {
Expand Down
Loading