shwapi.c
上传用户:tuheem
上传日期:2007-05-01
资源大小:21889k
文件大小:1k
- #include "stdafx.h"
- #include "globals.h"
- void path_add_backslash(char *path)
- {
- if (path[strlen(path) - 1] != '\')
- strcat(path, "\");
- }
- BOOL path_is_relative(const char *path)
- {
- char drive[_MAX_DRIVE];
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
- _splitpath(path, drive, dir, fname, ext);
- if (!*drive) {
- char buffer[MAX_PATH];
- char *position;
- strcpy(buffer, dir);
- if (buffer[0] == '\' && buffer[1] == '\') {
- position =
- strchr(strchr
- (strchr(strchr(buffer, '\') + 1, '\') +
- 1, '\') + 1, '\') + 1;
- *position = ' ';
- if (GetDriveType(buffer) == DRIVE_REMOTE)
- return FALSE;
- return TRUE;
- } else
- return TRUE;
- }
- return FALSE;
- }
- BOOL path_remove_filespec(LPTSTR path)
- {
- char drive[_MAX_DRIVE];
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
- _splitpath(path, drive, dir, fname, ext);
- _makepath(path, drive, dir, NULL, NULL);
- return TRUE;
- }
- void path_unquote(LPTSTR path)
- {
- char pathbuffer[MAX_PATH];
- int lengte;
- if (path[0] == '"') {
- strcpy(pathbuffer, path + 1);
- lengte = strlen(pathbuffer);
- pathbuffer[lengte - 1] = ' ';
- strcpy(path, pathbuffer);
- }
- }