view common/portpath.c @ 166:199878f09bf1

Merged
author Sascha Wilde <wilde@intevation.de>
date Tue, 25 Mar 2014 12:29:51 +0100
parents d47de01d6ad7 4a4b5e640d1a
children f100861dad8f
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/