ReactOS 0.4.15-dev-5672-gf73ac17
move.c File Reference
#include "precomp.h"
Include dependency graph for move.c:

Go to the source code of this file.

Enumerations

enum  { MOVE_NOTHING = 0x001 , MOVE_OVER_YES = 0x002 , MOVE_OVER_NO = 0x004 }
 
enum  {
  MOVE_SOURCE_IS_DIR = 0x001 , MOVE_SOURCE_IS_FILE = 0x002 , MOVE_DEST_IS_DIR = 0x004 , MOVE_DEST_IS_FILE = 0x008 ,
  MOVE_SOURCE_HAS_WILD = 0x010 , MOVE_SRC_CURRENT_IS_DIR = 0x020 , MOVE_DEST_EXISTS = 0x040 , MOVE_PATHS_ON_DIF_VOL = 0x080
}
 

Functions

static INT MoveOverwrite (LPTSTR fn)
 
void GetDirectory (LPTSTR wholepath, LPTSTR directory, BOOL CheckExisting)
 
INT cmd_move (LPTSTR param)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MOVE_NOTHING 
MOVE_OVER_YES 
MOVE_OVER_NO 

Definition at line 36 of file move.c.

37{
38 MOVE_NOTHING = 0x001, /* /N */
39 MOVE_OVER_YES = 0x002, /* /Y */
40 MOVE_OVER_NO = 0x004, /* /-Y */
41};
@ MOVE_OVER_YES
Definition: move.c:39
@ MOVE_OVER_NO
Definition: move.c:40
@ MOVE_NOTHING
Definition: move.c:38

◆ anonymous enum

anonymous enum
Enumerator
MOVE_SOURCE_IS_DIR 
MOVE_SOURCE_IS_FILE 
MOVE_DEST_IS_DIR 
MOVE_DEST_IS_FILE 
MOVE_SOURCE_HAS_WILD 
MOVE_SRC_CURRENT_IS_DIR 
MOVE_DEST_EXISTS 
MOVE_PATHS_ON_DIF_VOL 

Definition at line 43 of file move.c.

44{
45 /* Move status flags */
46 MOVE_SOURCE_IS_DIR = 0x001,
47 MOVE_SOURCE_IS_FILE = 0x002,
48 MOVE_DEST_IS_DIR = 0x004,
49 MOVE_DEST_IS_FILE = 0x008,
50 MOVE_SOURCE_HAS_WILD = 0x010, /* source has wildcard */
51 MOVE_SRC_CURRENT_IS_DIR = 0x020, /* source is file but at the current round we found a directory */
52 MOVE_DEST_EXISTS = 0x040,
53 MOVE_PATHS_ON_DIF_VOL = 0x080 /* source and destination paths are on different volume */
54};
@ MOVE_SOURCE_HAS_WILD
Definition: move.c:50
@ MOVE_PATHS_ON_DIF_VOL
Definition: move.c:53
@ MOVE_DEST_EXISTS
Definition: move.c:52
@ MOVE_DEST_IS_FILE
Definition: move.c:49
@ MOVE_SOURCE_IS_FILE
Definition: move.c:47
@ MOVE_SRC_CURRENT_IS_DIR
Definition: move.c:51
@ MOVE_DEST_IS_DIR
Definition: move.c:48
@ MOVE_SOURCE_IS_DIR
Definition: move.c:46

Function Documentation

◆ cmd_move()

INT cmd_move ( LPTSTR  param)

Definition at line 87 of file move.c.

88{
89 LPTSTR *arg;
90 INT argc, i, nFiles;
91 LPTSTR pszDest;
92 TCHAR szDestPath[MAX_PATH];
93 TCHAR szFullDestPath[MAX_PATH];
94 TCHAR szSrcDirPath[MAX_PATH];
95 TCHAR szSrcPath[MAX_PATH];
96 TCHAR szFullSrcPath[MAX_PATH];
97 DWORD dwFlags = 0;
98 INT nOverwrite = 0;
99 WIN32_FIND_DATA findBuffer;
101
102 /* used only when source and destination directories are on different volume */
103 HANDLE hDestFile = NULL;
104 WIN32_FIND_DATA findDestBuffer;
105 TCHAR szMoveDest[MAX_PATH];
106 TCHAR szMoveSrc[MAX_PATH];
107 LPTSTR pszDestDirPointer;
108 LPTSTR pszSrcDirPointer;
109 INT nDirLevel = 0;
110
111 LPTSTR pszFile;
112 BOOL OnlyOneFile;
113 BOOL FoundFile;
114 BOOL MoveStatus;
115 DWORD dwMoveFlags = 0;
116 DWORD dwMoveStatusFlags = 0;
117
118 if (!_tcsncmp (param, _T("/?"), 2))
119 {
120#if 0
121 ConOutPuts (_T("Moves files and renames files and directories.\n\n"
122 "To move one or more files:\n"
123 "MOVE [/N][/Y|/-Y][drive:][path]filename1[,...] destination\n"
124 "\n"
125 "To rename a directory:\n"
126 "MOVE [/N][/Y|/-Y][drive:][path]dirname1 dirname2\n"
127 "\n"
128 " [drive:][path]filename1 Specifies the location and name of the file\n"
129 " or files you want to move.\n"
130 " /N Nothing. Don everthing but move files or directories.\n"
131 " /Y\n"
132 " /-Y\n"
133 "..."));
134#else
136#endif
137 return 0;
138 }
139
140 nErrorLevel = 0;
142
143 /* read options */
144 for (i = 0; i < argc; i++)
145 {
146 if (!_tcsicmp(arg[i], _T("/N")))
148 else if (!_tcsicmp(arg[i], _T("/Y")))
150 else if (!_tcsicmp(arg[i], _T("/-Y")))
152 else
153 break;
154 }
155 nFiles = argc - i;
156
157 if (nFiles < 1)
158 {
159 /* there must be at least one pathspec */
161 nErrorLevel = 1;
162 goto Quit;
163 }
164
165 if (nFiles > 2)
166 {
167 /* there are more than two pathspecs */
169 nErrorLevel = 1;
170 goto Quit;
171 }
172
173 /* If no destination is given, default to current directory */
174 pszDest = (nFiles == 1) ? _T(".") : arg[i + 1];
175
176 /* check for wildcards in source and destination */
177 if (_tcschr(pszDest, _T('*')) != NULL || _tcschr(pszDest, _T('?')) != NULL)
178 {
179 /* '*'/'?' in dest, this doesnt happen. give folder name instead*/
181 nErrorLevel = 1;
182 goto Quit;
183 }
184 if (_tcschr(arg[i], _T('*')) != NULL || _tcschr(arg[i], _T('?')) != NULL)
185 {
186 dwMoveStatusFlags |= MOVE_SOURCE_HAS_WILD;
187 }
188
189 /* get destination */
190 GetFullPathName (pszDest, MAX_PATH, szDestPath, NULL);
191 TRACE ("Destination: %s\n", debugstr_aw(szDestPath));
192
193 /* get source folder */
194 GetFullPathName(arg[i], MAX_PATH, szSrcDirPath, &pszFile);
195 if (pszFile != NULL)
196 *pszFile = _T('\0');
197 TRACE ("Source Folder: %s\n", debugstr_aw(szSrcDirPath));
198
199 hFile = FindFirstFile (arg[i], &findBuffer);
201 {
203 nErrorLevel = 1;
204 goto Quit;
205 }
206
207 /* check for special cases "." and ".." and if found skip them */
208 FoundFile = TRUE;
209 while(FoundFile &&
210 (_tcscmp(findBuffer.cFileName,_T(".")) == 0 ||
211 _tcscmp(findBuffer.cFileName,_T("..")) == 0))
212 FoundFile = FindNextFile (hFile, &findBuffer);
213
214 if (!FoundFile)
215 {
216 /* what? we don't have anything to move? */
219 nErrorLevel = 1;
220 goto Quit;
221 }
222
223 OnlyOneFile = TRUE;
224 /* check if there can be found files as files have first priority */
225 if (findBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
226 dwMoveStatusFlags |= MOVE_SOURCE_IS_DIR;
227 else
228 dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
229 while(OnlyOneFile && FindNextFile(hFile,&findBuffer))
230 {
231 if (!(findBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
232 {
233 ConOutPrintf(_T(""));
234 if (dwMoveStatusFlags & MOVE_SOURCE_IS_FILE) OnlyOneFile = FALSE;
235 else
236 { /* this has been done this way so that we don't disturb other settings if they have been set before this */
237 dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
238 dwMoveStatusFlags &= ~MOVE_SOURCE_IS_DIR;
239 }
240 }
241 }
243
244 TRACE ("Do we have only one file: %s\n", OnlyOneFile ? "TRUE" : "FALSE");
245
246 /* we have to start again to be sure we don't miss any files or folders*/
247 hFile = FindFirstFile (arg[i], &findBuffer);
249 {
251 nErrorLevel = 1;
252 goto Quit;
253 }
254
255 /* check for special cases "." and ".." and if found skip them */
256 FoundFile = TRUE;
257 while(FoundFile &&
258 (_tcscmp(findBuffer.cFileName,_T(".")) == 0 ||
259 _tcscmp(findBuffer.cFileName,_T("..")) == 0))
260 FoundFile = FindNextFile (hFile, &findBuffer);
261
262 if (!FoundFile)
263 {
264 /* huh? somebody removed files and/or folders which were there */
267 nErrorLevel = 1;
268 goto Quit;
269 }
270
271 /* check if source and destination paths are on different volumes */
272 if (szSrcDirPath[0] != szDestPath[0])
273 dwMoveStatusFlags |= MOVE_PATHS_ON_DIF_VOL;
274
275 /* move it */
276 do
277 {
278 TRACE ("Found file/directory: %s\n", debugstr_aw(findBuffer.cFileName));
279 nOverwrite = 1;
280 dwMoveFlags = 0;
281 dwMoveStatusFlags &= ~MOVE_DEST_IS_FILE &
282 ~MOVE_DEST_IS_DIR &
283 ~MOVE_SRC_CURRENT_IS_DIR &
284 ~MOVE_DEST_EXISTS;
285 _tcscpy(szFullSrcPath,szSrcDirPath);
286 if (szFullSrcPath[_tcslen(szFullSrcPath) - 1] != _T('\\'))
287 _tcscat (szFullSrcPath, _T("\\"));
288 _tcscat(szFullSrcPath,findBuffer.cFileName);
289 _tcscpy(szSrcPath, szFullSrcPath);
290
291 if (IsExistingDirectory(szSrcPath))
292 {
293 /* source is directory */
294 if (dwMoveStatusFlags & MOVE_SOURCE_IS_FILE)
295 {
296 dwMoveStatusFlags |= MOVE_SRC_CURRENT_IS_DIR; /* source is file but at the current round we found a directory */
297 continue;
298 }
299 TRACE ("Source is dir: %s\n", debugstr_aw(szSrcPath));
301 }
302
303 /* if source is file we don't need to do anything special */
304 if (IsExistingDirectory(szDestPath))
305 {
306 /* destination is existing directory */
307 TRACE ("Destination is directory: %s\n", debugstr_aw(szDestPath));
308
309 dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
310
311 /*build the dest string(accounts for *)*/
312 _tcscpy (szFullDestPath, szDestPath);
313 /*check to see if there is an ending slash, if not add one*/
314 if (szFullDestPath[_tcslen(szFullDestPath) - 1] != _T('\\'))
315 _tcscat (szFullDestPath, _T("\\"));
316 _tcscat (szFullDestPath, findBuffer.cFileName);
317
318 if (IsExistingFile(szFullDestPath) || IsExistingDirectory(szFullDestPath))
319 dwMoveStatusFlags |= MOVE_DEST_EXISTS;
320
322 }
323 if (IsExistingFile(szDestPath))
324 {
325 /* destination is a file */
326 TRACE ("Destination is file: %s\n", debugstr_aw(szDestPath));
327
328 dwMoveStatusFlags |= MOVE_DEST_IS_FILE | MOVE_DEST_EXISTS;
329 _tcscpy (szFullDestPath, szDestPath);
330
332 }
333
334 TRACE ("Move Status Flags: 0x%X\n",dwMoveStatusFlags);
335
336 if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
337 dwMoveStatusFlags & MOVE_DEST_IS_DIR &&
338 dwMoveStatusFlags & MOVE_SOURCE_HAS_WILD)
339 {
340 /* We are not allowed to have existing source and destination dir when there is wildcard in source */
343 nErrorLevel = 1;
344 goto Quit;
345 }
346 if (!(dwMoveStatusFlags & (MOVE_DEST_IS_FILE | MOVE_DEST_IS_DIR)))
347 {
348 /* destination doesn't exist */
349 _tcscpy (szFullDestPath, szDestPath);
350 if (dwMoveStatusFlags & MOVE_SOURCE_IS_FILE) dwMoveStatusFlags |= MOVE_DEST_IS_FILE;
351 if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR) dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
352
354 }
355
356 if (dwMoveStatusFlags & MOVE_SOURCE_IS_FILE &&
357 dwMoveStatusFlags & MOVE_DEST_IS_FILE &&
358 !OnlyOneFile)
359 {
360 /*source has many files but there is only one destination file*/
363 nErrorLevel = 1;
364 goto Quit;
365 }
366
367 /*checks to make sure user wanted/wants the override*/
368 if ((dwFlags & MOVE_OVER_NO) &&
369 (dwMoveStatusFlags & MOVE_DEST_EXISTS))
370 continue;
371 if (!(dwFlags & MOVE_OVER_YES) &&
372 (dwMoveStatusFlags & MOVE_DEST_EXISTS))
373 nOverwrite = MoveOverwrite (szFullDestPath);
374 if (nOverwrite == PROMPT_NO || nOverwrite == PROMPT_BREAK)
375 continue;
376 if (nOverwrite == PROMPT_ALL)
378
379 ConOutPrintf (_T("%s => %s "), szSrcPath, szFullDestPath);
380
381 /* are we really supposed to do something */
382 if (dwFlags & MOVE_NOTHING)
383 continue;
384
385 /*move the file*/
386 if (!(dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
387 dwMoveStatusFlags & MOVE_PATHS_ON_DIF_VOL))
388 /* we aren't moving source folder to different drive */
389 MoveStatus = MoveFileEx (szSrcPath, szFullDestPath, dwMoveFlags);
390 else
391 { /* we are moving source folder to different drive */
392 _tcscpy(szMoveDest, szFullDestPath);
393 _tcscpy(szMoveSrc, szSrcPath);
394 DeleteFile(szMoveDest);
395 MoveStatus = CreateDirectory(szMoveDest, NULL); /* we use default security settings */
396 if (MoveStatus)
397 {
398 _tcscat(szMoveDest,_T("\\"));
399 _tcscat(szMoveSrc,_T("\\"));
400 nDirLevel = 0;
401 pszDestDirPointer = szMoveDest + _tcslen(szMoveDest);
402 pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc);
403 _tcscpy(pszSrcDirPointer,_T("*.*"));
404 hDestFile = FindFirstFile(szMoveSrc, &findDestBuffer);
405 if (hDestFile == INVALID_HANDLE_VALUE)
406 MoveStatus = FALSE;
407 else
408 {
409 BOOL FirstTime = TRUE;
410 FoundFile = TRUE;
411 MoveStatus = FALSE;
412 while(FoundFile)
413 {
414 if (FirstTime)
415 FirstTime = FALSE;
416 else
417 FoundFile = FindNextFile (hDestFile, &findDestBuffer);
418
419 if (!FoundFile)
420 {
421 /* Nothing to do in this folder so we stop working on it */
422 FindClose(hDestFile);
423 (pszSrcDirPointer)--;
424 (pszDestDirPointer)--;
425 _tcscpy(pszSrcDirPointer,_T(""));
426 _tcscpy(pszDestDirPointer,_T(""));
427 if (nDirLevel > 0)
428 {
430 INT_PTR nDiff;
431
432 FoundFile = TRUE; /* we need to continue our seek for files */
433 nDirLevel--;
434 RemoveDirectory(szMoveSrc);
435 GetDirectory(szMoveSrc,szTempPath,0);
436 nDiff = _tcslen(szMoveSrc) - _tcslen(szTempPath);
437 pszSrcDirPointer = pszSrcDirPointer - nDiff;
438 _tcscpy(pszSrcDirPointer,_T(""));
439 GetDirectory(szMoveDest,szTempPath,0);
440 nDiff = _tcslen(szMoveDest) - _tcslen(szTempPath);
441 pszDestDirPointer = pszDestDirPointer - nDiff;
442 _tcscpy(pszDestDirPointer,_T(""));
443 if (szMoveSrc[_tcslen(szMoveSrc) - 1] != _T('\\'))
444 _tcscat (szMoveSrc, _T("\\"));
445 if (szMoveDest[_tcslen(szMoveDest) - 1] != _T('\\'))
446 _tcscat (szMoveDest, _T("\\"));
447 pszDestDirPointer = szMoveDest + _tcslen(szMoveDest);
448 pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc);
449 _tcscpy(pszSrcDirPointer,_T("*.*"));
450 hDestFile = FindFirstFile(szMoveSrc, &findDestBuffer);
451 if (hDestFile == INVALID_HANDLE_VALUE)
452 continue;
453 FirstTime = TRUE;
454 }
455 else
456 {
457 MoveStatus = TRUE; /* we moved everything so lets tell user about it */
458 RemoveDirectory(szMoveSrc);
459 }
460 continue;
461 }
462
463 /* if we find "." or ".." we'll skip them */
464 if (_tcscmp(findDestBuffer.cFileName,_T(".")) == 0 ||
465 _tcscmp(findDestBuffer.cFileName,_T("..")) == 0)
466 continue;
467
468 _tcscpy(pszSrcDirPointer, findDestBuffer.cFileName);
469 _tcscpy(pszDestDirPointer, findDestBuffer.cFileName);
470 if (IsExistingFile(szMoveSrc))
471 {
472 FoundFile = CopyFile(szMoveSrc, szMoveDest, FALSE);
473 if (!FoundFile) continue;
474 DeleteFile(szMoveSrc);
475 }
476 else
477 {
478 FindClose(hDestFile);
479 CreateDirectory(szMoveDest, NULL);
480 _tcscat(szMoveDest,_T("\\"));
481 _tcscat(szMoveSrc,_T("\\"));
482 nDirLevel++;
483 pszDestDirPointer = szMoveDest + _tcslen(szMoveDest);
484 pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc);
485 _tcscpy(pszSrcDirPointer,_T("*.*"));
486 hDestFile = FindFirstFile(szMoveSrc, &findDestBuffer);
487 if (hDestFile == INVALID_HANDLE_VALUE)
488 {
489 FoundFile = FALSE;
490 continue;
491 }
492 FirstTime = TRUE;
493 }
494 }
495 }
496 }
497 }
498
499 if (MoveStatus)
500 {
502 }
503 else
504 {
506 nErrorLevel = 1;
507 }
508 }
509 while ((!OnlyOneFile || dwMoveStatusFlags & MOVE_SRC_CURRENT_IS_DIR ) &&
510 !(dwMoveStatusFlags & MOVE_SOURCE_IS_DIR) &&
511 FindNextFile (hFile, &findBuffer));
513
514 if(hDestFile && hDestFile != INVALID_HANDLE_VALUE)
515 FindClose(hDestFile);
516
517Quit:
518 freep(arg);
519 return nErrorLevel;
520}
static TCHAR szTempPath[MAX_PATH]
Definition: CImage.cpp:25
static int argc
Definition: ServiceArgs.c:12
static VOID ErrorMessage(DWORD dwErrorCode, LPWSTR szFormat,...)
Definition: attrib.c:51
INT nErrorLevel
Definition: cmd.c:158
BOOL IsExistingDirectory(IN LPCTSTR pszPath)
Definition: misc.c:504
BOOL IsExistingFile(IN LPCTSTR pszPath)
Definition: misc.c:498
VOID error_too_many_parameters(PCTSTR s)
Definition: error.c:79
VOID error_file_not_found(VOID)
Definition: error.c:93
VOID error_req_param_missing(VOID)
Definition: error.c:110
LPTSTR * splitspace(LPTSTR, LPINT)
Definition: misc.c:381
#define PROMPT_NO
Definition: cmd.h:330
#define PROMPT_ALL
Definition: cmd.h:332
VOID error_syntax(PCTSTR s)
Definition: error.c:152
VOID error_invalid_parameter_format(PCTSTR s)
Definition: error.c:145
#define PROMPT_BREAK
Definition: cmd.h:333
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:182
#define ConOutResPrintf(uID,...)
Definition: console.h:48
#define ConOutPrintf(szStr,...)
Definition: console.h:42
#define ConOutPuts(szStr)
Definition: console.h:30
void GetDirectory(LPTSTR wholepath, LPTSTR directory, BOOL CheckExisting)
Definition: move.c:65
static INT MoveOverwrite(LPTSTR fn)
Definition: move.c:56
#define debugstr_aw
Definition: precomp.h:43
#define STRING_MOVE_HELP2
Definition: resource.h:147
#define STRING_MOVE_ERROR2
Definition: resource.h:54
#define STRING_MOVE_ERROR1
Definition: resource.h:53
static VOID freep(LPSTR *p)
Definition: cmdcons.c:98
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
#define MOVEFILE_WRITE_THROUGH
Definition: filesup.h:30
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define MOVEFILE_COPY_ALLOWED
Definition: filesup.h:29
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _tcscmp
Definition: tchar.h:1424
#define _tcscat
Definition: tchar.h:622
#define _tcscpy
Definition: tchar.h:623
#define _tcsncmp
Definition: tchar.h:1428
#define _tcschr
Definition: tchar.h:1406
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
#define RemoveDirectory
Definition: winbase.h:3766
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define CopyFile
Definition: winbase.h:3612
#define CreateDirectory
Definition: winbase.h:3617
#define DeleteFile
Definition: winbase.h:3635
#define FindNextFile
Definition: winbase.h:3659
#define MoveFileEx
Definition: winbase.h:3749
#define FindFirstFile
Definition: winbase.h:3653
#define GetFullPathName
Definition: winbase.h:3692
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
void * arg
Definition: msvc.h:10
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198
#define _tcsicmp
Definition: xmlstorage.h:205

◆ GetDirectory()

void GetDirectory ( LPTSTR  wholepath,
LPTSTR  directory,
BOOL  CheckExisting 
)

Definition at line 65 of file move.c.

66{
67 /* returns only directory part of path with backslash */
68 /* TODO: make code unc aware */
69 /* Is there a better alternative to this? */
71 if (CheckExisting && IsExistingDirectory(wholepath))
72 {
73 _tcscpy(directory, wholepath);
74 }
75 else if ((last = _tcsrchr(wholepath,_T('\\'))) != NULL)
76 {
77 _tcsncpy(directory, wholepath, last - wholepath + 1);
78 directory[last - wholepath + 1] = 0;
79 }
80 else
81 {
82 GetRootPath(wholepath,directory, MAX_PATH);
83 }
84}
INT GetRootPath(IN LPCTSTR InPath, OUT LPTSTR OutPath, IN INT size)
Definition: internal.c:152
POINT last
Definition: font.c:46
#define _tcsncpy
Definition: tchar.h:1410
#define _tcsrchr
Definition: utility.h:116

Referenced by cmd_move(), and DECLARE_INTERFACE_().

◆ MoveOverwrite()

static INT MoveOverwrite ( LPTSTR  fn)
static

Definition at line 56 of file move.c.

57{
58 /* ask the user if they want to override */
59 INT res;
61 res = FilePromptYNA (0);
62 return res;
63}
INT FilePromptYNA(UINT)
Definition: misc.c:623
#define STRING_MOVE_HELP1
Definition: resource.h:146
GLuint res
Definition: glext.h:9613
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

Referenced by cmd_move().