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 file to memory fix #20

Merged
merged 2 commits into from Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -94,6 +94,8 @@ public:
{
immutable langs = findTranslations (suite, section);

logDebug ("Found translations for: %s", langs.join(", "));

foreach (const ref lang; langs) {
string fname;

@@ -117,7 +119,6 @@ public:
auto tagf = new TagFile ();
tagf.open (fname);

logDebug ("Opened: %s", fname);
do {
auto pkgname = tagf.readField ("Package");
auto rawDesc = tagf.readField ("Description-%s".format (lang));
@@ -411,21 +411,21 @@ string[] getFileContents (const string path, const uint retryCount = 5) @trusted

size_t sz = 0;

auto f = open_memstream (&ptr, &sz);
scope (exit) fclose (f);

auto file = File.wrapFile (f);

if (path.isRemote) {
download (path, file, retryCount);
{
auto f = open_memstream (&ptr, &sz);
scope (exit) fclose (f);
auto file = File.wrapFile (f);
download (path, file, retryCount);
}

return to!string (ptr.fromStringz).splitLines;
} else {
if (!std.file.exists (path))
throw new Exception ("No such file '%s'", path);

return std.file.readText (path).splitLines;
}

return to!string (ptr.fromStringz).splitLines;
}

/**