view common/portpath.c @ 165:d47de01d6ad7

Implemented port_realpath for windows.
author Sascha Wilde <wilde@intevation.de>
date Tue, 25 Mar 2014 12:25:39 +0100
parents 6d64d7e9fa32
children 199878f09bf1
line wrap: on
line source
#include "portpath.h"

#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>


char *
port_dirname(char *path)
{
#ifndef _WIN32
  return dirname(path);
#else
  char drive[_MAX_DRIVE];
  char dir[_MAX_DIR];
  _splitpath(path, drive, dir, NULL, NULL);
  /* We assume: drive + dir is shorter than
   * drive + dir + fname + ext */
  sprintf(path, "%s%s", drive, dir);
  return path;
#endif
}

char *
port_realpath(char *path)
{
#ifndef _WIN32
  return realpath(path, NULL);
#else
  return _fullpath(NULL, path, 0);
#endif
}

http://wald.intevation.org/projects/trustbridge/