Skip to content

OnPostprocessAllAssets does not work on Windows #24

@AntonPetrov83

Description

@AntonPetrov83

All Unity paths are with Unix separator / while Path.Combine() under Windows uses \
So comparing if (str.Equals(Paths.configPath)) won't work.
This breaks the main Setup window.

Fixed with:

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
            string[] movedFromAssetPaths)
        {
            // handle windows paths.
            var configPath = Path.DirectorySeparatorChar == '/'
                ? Paths.configPath
                : Paths.configPath.Replace(Path.DirectorySeparatorChar, '/');
            
            foreach (string str in importedAssets)
            {
                // We are interested in knowing when the SetupConfig has been re-imported so that it can correctly be
                // loaded and used by the Init function.
                if (str.Equals(configPath))
                {
                    Init();
                    break;
                }
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions