r=mkaply, a=brendan
OS/2 bring up - rewrite some nsLocalFileOS2 stuff to be more like Windows
This commit is contained in:
mkaply@us.ibm.com
2000-06-20 14:06:00 +00:00
parent 386ea5b13a
commit 8fcbe0b05c
2 changed files with 1462 additions and 384 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* /*
* The contents of this file are subject to the Netscape Public * The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file * License Version 1.1 (the "License"); you may not use this file
@@ -20,6 +20,13 @@
* *
* Contributor(s): * Contributor(s):
* Henry Sobotka <sobotka@axess.com> * Henry Sobotka <sobotka@axess.com>
*
* This Original Code has been modified by IBM Corporation. Modifications made by IBM
* described herein are Copyright (c) International Business Machines Corporation, 2000.
* Modifications to Mozilla code or documentation identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 05/26/2000 IBM Corp. Make more like Windows.
*/ */
#ifndef _nsLocalFileOS2_H_ #ifndef _nsLocalFileOS2_H_
@@ -40,6 +47,7 @@
#define INCL_DOSMODULEMGR #define INCL_DOSMODULEMGR
#include <os2.h> #include <os2.h>
#if 0 // OLDWAY
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -57,7 +65,7 @@
inline nsresult inline nsresult
nsresultForErrno(int err) nsresultForErrno(int err)
{ {
#ifdef DEBUG_sobotka #ifdef DEBUG
if (err) if (err)
fprintf(stderr, "errno %d\n", err); fprintf(stderr, "errno %d\n", err);
#endif #endif
@@ -77,6 +85,7 @@ nsresultForErrno(int err)
} }
#define NSRESULT_FOR_ERRNO() nsresultForErrno(errno) #define NSRESULT_FOR_ERRNO() nsresultForErrno(errno)
#endif
class NS_COM nsLocalFile : public nsILocalFile class NS_COM nsLocalFile : public nsILocalFile
{ {
@@ -99,33 +108,31 @@ public:
private: private:
// String guaranteed to be native path // this is the flag which indicates if I can used cached information about the file
nsCString mPath; PRBool mDirty;
nsresult CheckDrive(const char* inPath); PRBool mLastResolution;
// Filehandling method // this string will alway be in native format!
nsresult CopyMove(nsIFile *newParentDir, const char *newName, PRBool move); nsCString mWorkingPath;
// stat caching members and inline methods // this will be the resolve path which will *NEVER* be return to the user
PRBool mHaveStatCached; nsCString mResolvedPath;
struct stat mStatCache;
void SetNoStatCache() { mHaveStatCached = PR_FALSE; } #if defined(XP_PC) && !defined(XP_OS2)
IPersistFile* mPersistFile;
nsresult LoadStatCache() { IShellLink* mShellLink;
if (stat((const char*)mPath, &mStatCache) == -1) {
#ifdef DEBUG_sobotka
fprintf(stderr, "stat(%s) failed; errno: %d\n", (const char *)mPath, errno);
#endif #endif
return NS_ERROR_FAILURE;
}
mHaveStatCached = PR_TRUE;
return NS_OK;
}
// Check path for system-reserved chars (inPath = whatever follows drive colon, if any) PRFileInfo64 mFileInfo64;
PRBool ValidatePath(const char* inPath) {
return ((strpbrk(inPath, "<>:\"|") == NULL) ? PR_TRUE : PR_FALSE); void MakeDirty();
} nsresult ResolveAndStat(PRBool resolveTerminal);
nsresult ResolvePath(const char* workingPath, PRBool resolveTerminal, char** resolvedPath);
nsresult CopyMove(nsIFile *newParentDir, const char *newName, PRBool followSymlinks, PRBool move);
nsresult CopySingleFile(nsIFile *source, nsIFile* dest, const char * newName, PRBool followSymlinks, PRBool move);
nsresult SetModDate(PRInt64 aLastModificationDate, PRBool resolveTerminal);
}; };
#endif // _nsLocalFileOS2_H_
#endif