summaryrefslogtreecommitdiff
path: root/apt-private/private-sources.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-11-29 08:35:05 +0100
committerMichael Vogt <mvo@debian.org>2013-11-29 08:37:54 +0100
commitcf993341c2067ee091cfd51e5da0e237babce171 (patch)
tree1ece0eaaaea76acf5fba1c74054873d80ef633b5 /apt-private/private-sources.cc
parenta8f671c17a7f34e80a49bf367bceaa009551b066 (diff)
add "APT::String::Endswith" and automatic adding of ".list" in apt edit-source
Diffstat (limited to 'apt-private/private-sources.cc')
-rw-r--r--apt-private/private-sources.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc
index 37b0534bd..65706e785 100644
--- a/apt-private/private-sources.cc
+++ b/apt-private/private-sources.cc
@@ -21,10 +21,13 @@ bool EditSources(CommandLine &CmdL)
std::string sourceslist;
if (CmdL.FileList[1] != NULL)
- sourceslist = _config->FindDir("Dir::Etc::sourceparts") + CmdL.FileList[1] + ".list";
- else
+ {
+ sourceslist = _config->FindDir("Dir::Etc::sourceparts") + CmdL.FileList[1];
+ if (!APT::String::Endswith(sourceslist, ".list"))
+ sourceslist += ".list";
+ } else {
sourceslist = _config->FindFile("Dir::Etc::sourcelist");
-
+ }
HashString before;
if (FileExists(sourceslist))
before.FromFile(sourceslist);
@@ -38,6 +41,7 @@ bool EditSources(CommandLine &CmdL)
strprintf(outs, _("Failed to parse %s. Edit again? "),
sourceslist.c_str());
std::cout << outs;
+ // FIXME: should we add a "restore previous" option here?
res = !YnPrompt(true);
}
_error->RevertToStack();