]> git.lyx.org Git - lyx.git/blob - development/Win32/win32_kludge.diff
Fix make dist breakage
[lyx.git] / development / Win32 / win32_kludge.diff
1 Index: src/support/filetools.C
2 ===================================================================
3 RCS file: /cvs/lyx/lyx-devel/src/support/filetools.C,v
4 retrieving revision 1.209
5 diff -u -r1.209 filetools.C
6 --- src/support/filetools.C     2005/04/21 14:03:30     1.209
7 +++ src/support/filetools.C     2005/04/26 15:43:13
8 @@ -1051,6 +1051,11 @@
9  
10  cmd_ret const RunCommand(string const & cmd)
11  {
12 +#ifdef _WIN32
13 +       // TODO: Implement this, or merge it into forkedcall.
14 +       // Used for lyx2lyx in buffer.C, echo in math_extern and kpse in this file
15 +       return make_pair(-1, string());
16 +#else
17         // FIXME: replace all calls to RunCommand with ForkedCall
18         // (if the output is not needed) or the code in ispell.C
19         // (if the output is needed).
20 @@ -1080,6 +1085,7 @@
21                 perror("RunCommand:: could not terminate child process");
22  
23         return make_pair(pret, ret);
24 +#endif
25  }
26  
27  
28 Index: src/support/tempname.C
29 ===================================================================
30 RCS file: /cvs/lyx/lyx-devel/src/support/tempname.C,v
31 retrieving revision 1.26
32 diff -u -r1.26 tempname.C
33 --- src/support/tempname.C      2005/04/26 10:30:24     1.26
34 +++ src/support/tempname.C      2005/04/26 15:51:22
35 @@ -32,6 +32,10 @@
36  # endif
37  #endif
38  
39 +#ifdef _WIN32
40 +# include <io.h>
41 +#endif
42 +
43  using boost::scoped_array;
44  
45  using std::string;
46 @@ -44,6 +48,9 @@
47  {
48  #if defined(HAVE_MKSTEMP)
49         return ::mkstemp(templ);
50 +#elif defined(_WIN32)
51 +    ::_mktemp(templ);
52 +    return (int) ::fopen(templ, "w");
53  #elif defined(HAVE_MKTEMP)
54         // This probably just barely works...
55         ::mktemp(templ);
56 @@ -60,7 +67,9 @@
57  {
58         string const tmpdir(dir.empty() ? package().temp_dir() : dir);
59         string tmpfl(AddName(tmpdir, mask));
60 +#ifndef _WIN32
61         tmpfl += convert<string>(getpid());
62 +#endif
63         tmpfl += "XXXXXX";
64  
65         // The supposedly safe mkstemp version
66 @@ -71,7 +80,11 @@
67         int const tmpf = make_tempfile(tmpl.get());
68         if (tmpf != -1) {
69                 string const t(tmpl.get());
70 +#ifdef _WIN32
71 +        ::fclose((FILE *) tmpf);
72 +#else
73                 ::close(tmpf);
74 +#endif
75                 lyxerr[Debug::FILES] << "Temporary file `" << t
76                                      << "' created." << endl;
77                 return t;