/[winpt]/trunk/Src/wptW32API.cpp
ViewVC logotype

Diff of /trunk/Src/wptW32API.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 137 by twoaday, Mon Jan 9 14:01:51 2006 UTC revision 150 by twoaday, Wed Jan 18 11:52:45 2006 UTC
# Line 309  make_filename (const char *path, const c Line 309  make_filename (const char *path, const c
309  }  }
310    
311    
312    /* Generate a file name from a special dirctory. */
313    char*
314    make_special_filename (int folder, const char *file, const char *ext)
315    {
316        BOOL ec;
317        char path[MAX_PATH], *p;
318        size_t n=0;
319    
320        /* MSDN: buf must be at least MAX_PATH=256 bytes */
321        ec = SHGetSpecialFolderPath (HWND_DESKTOP, path, folder, TRUE);
322        if (ec != 1) {
323            log_debug ("SHGetSpecialFolderPath() failed\r\n", (int)GetLastError ());
324            return NULL;
325        }
326    
327        n = strlen (path)+1;
328        if (file)
329            n += strlen (file)+1;
330        if (ext)
331            n += strlen (ext)+1;
332        p = new char[n+2];
333        if (!p)
334            BUG (0);
335        memset (p, 0, n+2);
336        strcpy (p, path);    
337        if (file) {
338            strcat (p, "\\");
339            strcat (p, file);
340        }
341        if (ext)
342            strcat (p, ext);
343        return p;
344    }
345    
346    
347  /* return 0 if the file @fname exists, otherwise >0. */  /* return 0 if the file @fname exists, otherwise >0. */
348  int  int
349  file_exist_check (const char *fname)  file_exist_check (const char *fname)

Legend:
Removed from v.137  
changed lines
  Added in v.150

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26