projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated Traditional Chines translation
[apt.git]
/
methods
/
file.cc
diff --git
a/methods/file.cc
b/methods/file.cc
index 64490749b5fa2568beb288b4e10c14e7a444a4ac..3500de9f5f100cab17ac53e8e97af267e7773845 100644
(file)
--- a/
methods/file.cc
+++ b/
methods/file.cc
@@
-1,6
+1,6
@@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: file.cc,v 1.
4 1998/10/30 07:53:52 jgg
Exp $
+// $Id: file.cc,v 1.
9.2.1 2004/01/16 18:58:50 mdz
Exp $
/* ######################################################################
File URI method for APT
/* ######################################################################
File URI method for APT
@@
-18,25
+18,29
@@
#include <sys/stat.h>
#include <unistd.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <apti18n.h>
/*}}}*/
class FileMethod : public pkgAcqMethod
{
/*}}}*/
class FileMethod : public pkgAcqMethod
{
- virtual bool Fetch(
string Message,URI Get
);
+ virtual bool Fetch(
FetchItem *Itm
);
public:
public:
- FileMethod() : pkgAcqMethod("1.0",SingleInstance) {};
+ FileMethod() : pkgAcqMethod("1.0",SingleInstance
| LocalOnly
) {};
};
// FileMethod::Fetch - Fetch a file /*{{{*/
// ---------------------------------------------------------------------
/* */
};
// FileMethod::Fetch - Fetch a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool FileMethod::Fetch(
string Message,URI Get
)
+bool FileMethod::Fetch(
FetchItem *Itm
)
{
{
+ URI Get = Itm->Uri;
string File = Get.Path;
FetchResult Res;
string File = Get.Path;
FetchResult Res;
-
+ if (Get.Host.empty() == false)
+ return _error->Error(_("Invalid URI, local URIS must not start with //"));
+
// See if the file exists
struct stat Buf;
if (stat(File.c_str(),&Buf) == 0)
// See if the file exists
struct stat Buf;
if (stat(File.c_str(),&Buf) == 0)
@@
-45,7
+49,7
@@
bool FileMethod::Fetch(string Message,URI Get)
Res.Filename = File;
Res.LastModified = Buf.st_mtime;
Res.IMSHit = false;
Res.Filename = File;
Res.LastModified = Buf.st_mtime;
Res.IMSHit = false;
- if (
LastModified == Buf.st_mtime
)
+ if (
Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0
)
Res.IMSHit = true;
}
Res.IMSHit = true;
}
@@
-61,7
+65,7
@@
bool FileMethod::Fetch(string Message,URI Get)
AltRes.Filename = File;
AltRes.LastModified = Buf.st_mtime;
AltRes.IMSHit = false;
AltRes.Filename = File;
AltRes.LastModified = Buf.st_mtime;
AltRes.IMSHit = false;
- if (
LastModified == Buf.st_mtime
)
+ if (
Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0
)
AltRes.IMSHit = true;
URIDone(Res,&AltRes);
AltRes.IMSHit = true;
URIDone(Res,&AltRes);
@@
-70,7
+74,7
@@
bool FileMethod::Fetch(string Message,URI Get)
}
if (Res.Filename.empty() == true)
}
if (Res.Filename.empty() == true)
- return _error->Error(
"File not found"
);
+ return _error->Error(
_("File not found")
);
URIDone(Res);
return true;
URIDone(Res);
return true;
@@
-79,6
+83,8
@@
bool FileMethod::Fetch(string Message,URI Get)
int main()
{
int main()
{
+ setlocale(LC_ALL, "");
+
FileMethod Mth;
return Mth.Run();
}
FileMethod Mth;
return Mth.Run();
}