]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-extracttemplates.cc
add test for Suite with path
[apt.git] / cmdline / apt-extracttemplates.cc
index 60efafba544283d9b0ee0c569abfab0297bbe2f1..8e1937113ff92ac50c4a6a6d3d8784ef96026b94 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <locale.h>
+
 #include <fstream>
 
 #include <fstream>
 
-#include <locale.h>
-#include <apti18n.h>
 #include "apt-extracttemplates.h"
 #include "apt-extracttemplates.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
 
                                                                        /*}}}*/
 
 using namespace std;
 
-#define TMPDIR         "/tmp"
-
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object                     /*{{{*/
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object                     /*{{{*/
@@ -251,14 +251,11 @@ string WriteFile(const char *package, const char *prefix, const char *data)
 {
        char fn[512];
        static int i;
 {
        char fn[512];
        static int i;
-       const char *tempdir = NULL;
-
-        tempdir = getenv("TMPDIR");
-        if (tempdir == NULL)
-             tempdir = TMPDIR;
 
 
+        std::string tempdir = GetTempDir();
        snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
        snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
-                 _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+                 _config->Find("APT::ExtractTemplates::TempDir", 
+                               tempdir.c_str()).c_str(),
                  package, prefix, getpid(), i++);
        FileFd f;
        if (data == NULL)
                  package, prefix, getpid(), i++);
        FileFd f;
        if (data == NULL)