public void saveMod(Path path, Mod mod) throws IOException
	{
		Path dir = path == null ? mod.getSourceFolder() : path;
		if(dir == null)
			throw new IllegalArgumentException("No path was provided");
		if(Files.notExists(path))
			Files.createDirectory(dir);
		ModInfo info = mod.getInfo();
		Util.writeJsonToFile(info.getObject(), dir.resolve(info.getName() + ".modinfo"));
		Path assetPath = mod.getAssetFolder();
		for(Asset a: mod.getAssets())
		{
			if(a.getClass() != Asset.class)
			{
				if(!a.isLoaded())a.load();
				a.saveWithSource(assetPath);
			}
			else if(a.getSource() != null)
			{
				Path n = assetPath.resolve(a.getPath());
				Files.createDirectories(n.getParent());
				Files.copy(a.getSource(), n);
			}
		}
		ModToolkit.log.info("Mod saved: " + path.toAbsolutePath().toString());
	}