From: Iain Patterson Date: Wed, 20 Nov 2013 15:14:56 +0000 (+0000) Subject: Added strip_basename() function. X-Git-Tag: v2.19~11 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=bf75c3da8b88b87c298e2b358a8d38c8476fa85b;p=nssm.git Added strip_basename() function. Helper function to determine the parent directory of a path. --- diff --git a/gui.cpp b/gui.cpp index 5aaf016..5ceb33f 100644 --- a/gui.cpp +++ b/gui.cpp @@ -1,5 +1,14 @@ #include "nssm.h" +static void strip_basename(char *buffer) { + size_t len = strlen(buffer); + size_t i; + for (i = len; i && buffer[i] != '\\' && buffer[i] != '/'; i--); + /* X:\ is OK. */ + if (i && buffer[i-1] == ':') i++; + buffer[i] = '\0'; +} + int nssm_gui(int resource, char *name) { /* Create window */ HWND dlg = CreateDialog(0, MAKEINTRESOURCE(resource), 0, install_dlg);