From b68631ee5674e95ce6543e3d52807ae87e1f4d97 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 17 Mar 2015 18:09:59 +0300 Subject: [PATCH] Make fltkutil.cpp independent of FLTK and rename it to unixutil.cpp. fltkutil.cpp should be independent of FLTK so that it can be linked into libslvs while neither requiring every user of the library to reimplement these support routines nor requiring linking in FLTK. --- src/CMakeLists.txt | 2 +- src/{fltk/fltkutil.cpp => unix/unixutil.cpp} | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) rename src/{fltk/fltkutil.cpp => unix/unixutil.cpp} (91%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 526105d..9e8c039 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,7 +32,7 @@ if(WIN32) win32/w32util.cpp) else() set(util_SOURCES - fltk/fltkutil.cpp) + unix/unixutil.cpp) endif() # libslvs diff --git a/src/fltk/fltkutil.cpp b/src/unix/unixutil.cpp similarity index 91% rename from src/fltk/fltkutil.cpp rename to src/unix/unixutil.cpp index 700029b..7326f30 100644 --- a/src/fltk/fltkutil.cpp +++ b/src/unix/unixutil.cpp @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// Utility functions used by the FLTK port. Notably, our memory allocation; +// Utility functions used by the Unix port. Notably, our memory allocation; // we use two separate allocators, one for long-lived stuff and one for // stuff that gets freed after every regeneration of the model, to save us // the trouble of freeing the latter explicitly. @@ -13,8 +13,6 @@ #include #include -#include - #include "solvespace.h" void dbp(const char *str, ...) @@ -31,9 +29,9 @@ void dbp(const char *str, ...) void GetAbsoluteFilename(char *file) { - char absoluteFile[PATH_MAX]; - fl_filename_absolute(absoluteFile, sizeof(absoluteFile), file); - strcpy(file, absoluteFile); + char expanded[MAX_PATH]; + realpath(file, expanded); + strcpy(file, expanded); } //-----------------------------------------------------------------------------