view common/portpath.c @ 164:6d64d7e9fa32

Implemented port_dirname for windows.
author Sascha Wilde <wilde@intevation.de>
date Tue, 25 Mar 2014 12:01:26 +0100
parents 306e4db11761
children d47de01d6ad7
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
  fprintf(stderr, "Windows Suport missing!");
  abort();
#endif
}

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