diff --git a/lib/stateManagement/preferencesData.dart b/lib/stateManagement/preferencesData.dart index 5817a8f..9b6fd5f 100644 --- a/lib/stateManagement/preferencesData.dart +++ b/lib/stateManagement/preferencesData.dart @@ -1,7 +1,10 @@ +import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:path/path.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../background/IdLookup.dart'; @@ -150,7 +153,7 @@ class PreferencesData extends OpenFileData { lastWwiseProjectSettings = SavableProp("lastWwiseProjectSettings", _prefs!, {}); lastHierarchyFiles = SavableProp("lastHierarchyFiles", _prefs!, []); lastColorPickerMode = SavableProp("lastColorPickerMode", _prefs!, 0); - + unawaited(_tryAutoInitPaths()); await super.load(); _loadingState = LoadingState.loaded; } @@ -180,6 +183,22 @@ class PreferencesData extends OpenFileData { Undoable takeSnapshot() { return this; } + + Future _tryAutoInitPaths() async { + var wwisePath = wwise2012CliPath!.value; + if (wwisePath.isNotEmpty) + return; + const searchPath = r"C:\Program Files (x86)\Audiokinetic"; + var cliPaths = (await Directory(searchPath).list(recursive: true).toList()) + .whereType() + .map((file) => file.path) + .where((file) => file.contains("Wwise v2012")) + .where((file) => file.contains("x64")) + .where((file) => basename(file) == "WwiseCLI.exe") + .firstOrNull; + if (cliPaths != null) + wwise2012CliPath!.value = cliPaths; + } } class IndexingPathsProp extends ListNotifier { diff --git a/lib/widgets/misc/preferencesEditor.dart b/lib/widgets/misc/preferencesEditor.dart index 26195a6..e4334fd 100644 --- a/lib/widgets/misc/preferencesEditor.dart +++ b/lib/widgets/misc/preferencesEditor.dart @@ -345,7 +345,7 @@ class _PreferencesEditorState extends ChangeNotifierState { const SizedBox(width: 20,), const Text("Download for example from "), TextButton( - onPressed: () => launchUrl(Uri.parse("https://mega.nz/file/5SQ3SKCK#pDTdNl7rP2SrFe_6w2JY2E6JqfP_bPosGl4fYHE2R9U")), + onPressed: () => launchUrl(Uri.parse("https://www.saintsrowmods.com/forum/pages/wwise-sriv/#:~:text=I%20agree%2C%20download%20Wwise")), child: Text("here", style: TextStyle(decoration: TextDecoration.underline),), ), ],