mirror of
				https://github.com/packwiz/packwiz.git
				synced 2025-10-31 18:44:33 +01:00 
			
		
		
		
	Use the correct directories for non-mod files; use .pw.toml extension
The mods-folder option is now replaced with two new options: meta-folder and meta-folder-base This allows non-mod files to use the correct directory based on their category; with correct import of resource packs/etc from CurseForge packs, and the ability to override this behaviour. To improve the reliability of packwiz metadata file marking (in the index), new files now use .pw.toml as the extension - any extension can be used, but .pw.toml will now be automatically be marked as a metafile regardless of folder, so you can easily move metadata files around. Existing metadata files will still work (as metafile = true is set in the index); though in the future .pw.toml may be required.
This commit is contained in:
		| @@ -150,16 +150,9 @@ func (in *Index) updateFile(path string) error { | ||||
| 	} | ||||
|  | ||||
| 	mod := false | ||||
| 	// If the file has an extension of toml and is in the mods folder, set mod to true | ||||
| 	absFileDir, err := filepath.Abs(filepath.Dir(path)) | ||||
| 	if err == nil { | ||||
| 		modsDir := filepath.Join(in.GetPackRoot(), viper.GetString("mods-folder")) | ||||
| 		absModsDir, err := filepath.Abs(modsDir) | ||||
| 		if err == nil { | ||||
| 			if absFileDir == absModsDir && strings.HasSuffix(filepath.Base(path), ".toml") { | ||||
| 				mod = true | ||||
| 			} | ||||
| 		} | ||||
| 	// If the file has an extension of pw.toml, set mod to true | ||||
| 	if strings.HasSuffix(filepath.Base(path), MetaExtension) { | ||||
| 		mod = true | ||||
| 	} | ||||
|  | ||||
| 	return in.updateFileHashGiven(path, "sha256", hashString, mod) | ||||
| @@ -341,7 +334,7 @@ func (in Index) FindMod(modName string) (string, bool) { | ||||
| 	for _, v := range in.Files { | ||||
| 		if v.MetaFile { | ||||
| 			_, file := filepath.Split(v.File) | ||||
| 			fileTrimmed := strings.TrimSuffix(file, ModExtension) | ||||
| 			fileTrimmed := strings.TrimSuffix(file, MetaExtension) | ||||
| 			if fileTrimmed == modName { | ||||
| 				return filepath.Join(filepath.Dir(in.indexFile), filepath.FromSlash(v.File)), true | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user