+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

feat: ability to use multiple wow folders with a single ajour instance #574

Merged
merged 21 commits into from
Mar 22, 2021

Conversation

casperstorm
Copy link
Member

@casperstorm casperstorm commented Mar 16, 2021

With this PR it is possible to manage multiple World of Warcraft folders. Use case is if you have retail and classic in two different dirs.

Checklist

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users

@casperstorm casperstorm requested a review from tarkah March 16, 2021 23:05
@casperstorm
Copy link
Member Author

@tarkah im pretty happy with the outcome of this PR. Please let me know what you think.

@tarkah
Copy link
Member

tarkah commented Mar 17, 2021

@casperstorm looks good. I've added some comments but it's small stuff. I need to do some testing still. Awesome job!

@casperstorm
Copy link
Member Author

How and where should we check for newly added paths? One way is to do the following:

    // Check if any new flavor has been added since last time.
    // Get missing flavors.
    let mut missing_flavors: Vec<&Flavor> = vec![];
    for flavor in Flavor::ALL.iter() {
        if let None = ajour.config.wow.directories.get(flavor) {
            missing_flavors.push(flavor);
        }
    }

    let flavors = &ajour.config.wow.directories.keys().collect::<Vec<_>>();
    for flavor in flavors {
        // Find root dir of the flavor and check if any of the missing_flavor's is there.
        // If it is, we added it to the directories.
        if let Some(root_dir) = ajour.config.get_root_directory_for_flavor(flavor) {
            for missing_flavor in &missing_flavors {
                let flavor_dir = ajour
                    .config
                    .get_flavor_directory_for_flavor(missing_flavor, &root_dir);
                if flavor_dir.exists() {
                    ajour
                         .config
                         .wow
                         .directories
                         .insert(**missing_flavor, flavor_dir);
                }
            }
        }
    }

@tarkah
Copy link
Member

tarkah commented Mar 19, 2021

How and where should we check for newly added paths? One way is to do the following:

    // Check if any new flavor has been added since last time.
    // Get missing flavors.
    let mut missing_flavors: Vec<&Flavor> = vec![];
    for flavor in Flavor::ALL.iter() {
        if let None = ajour.config.wow.directories.get(flavor) {
            missing_flavors.push(flavor);
        }
    }

    let flavors = &ajour.config.wow.directories.keys().collect::<Vec<_>>();
    for flavor in flavors {
        // Find root dir of the flavor and check if any of the missing_flavor's is there.
        // If it is, we added it to the directories.
        if let Some(root_dir) = ajour.config.get_root_directory_for_flavor(flavor) {
            for missing_flavor in &missing_flavors {
                let flavor_dir = ajour
                    .config
                    .get_flavor_directory_for_flavor(missing_flavor, &root_dir);
                if flavor_dir.exists() {
                    ajour
                         .config
                         .wow
                         .directories
                         .insert(**missing_flavor, flavor_dir);
                }
            }
        }
    }

Agreed, lets put this under the Parse message so it checks everytime the user launches or refreshes

@casperstorm
Copy link
Member Author

casperstorm commented Mar 19, 2021

@tarkah i've added the logic we discussed now. I found another case I solved as well. As i see it this is the QA:

  • You should not see a "Welcome to Ajour" when coming from a previous version. Check settings to see if mapping was successful.
  • Adding a new path to a flavor you don't have works.
  • You can see addons in the new path.
  • Adding a new path, to an already existing flavor should overwrite it.
  • You can see addons in the new (overwritten) path.
  • Removing a known flavor path should remove it during refresh.
  • Adding a new flavor to a known path should add it automatically.

@casperstorm casperstorm merged commit c0d2580 into development Mar 22, 2021
@casperstorm casperstorm deleted the feat/multiple-paths branch March 22, 2021 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载