Better llgen windowsification.

This commit is contained in:
David Given 2022-07-15 00:43:34 +02:00
parent e7626705f6
commit 98d37492ec
2 changed files with 14 additions and 1 deletions

View file

@ -18,7 +18,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
# include "extern.h"
# include "types.h"

View file

@ -374,6 +374,15 @@ void copyto(string target, string source)
fclose(ftarget);
}
static int isabspath(string path)
{
if (path[0] == '/') /* Unix paths */
return 1;
if (path[0] && (path[1] == ':')) /* Windows paths */
return 1;
return 0;
}
void install(string target, string source)
{
/*
@ -384,7 +393,7 @@ void install(string target, string source)
register int c1, c2;
register FILE *f1, *f2;
int cnt;
string realtarget = (target[0] != '/') ? aprintf("%s/%s", f_dir, target) : target;
string realtarget = !isabspath(target) ? aprintf("%s/%s", f_dir, target) : target;
/*
* First open temporary, generated for source