Back to index

lightning-sunbird  0.9+nobinonly
Defines | Enumerations | Functions
nsFileSpec.cpp File Reference
#include "nsFileSpec.h"
#include "nsDebug.h"
#include "nsEscape.h"
#include "nsMemory.h"
#include "prtypes.h"
#include "plstr.h"
#include "plbase64.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsILocalFile.h"
#include <string.h>
#include <stdio.h>

Go to the source code of this file.


#define DIR_SEPARATOR   '/'
#define DIR_STRCMP   strcmp


enum  { kMaxFilenameLength = 31, kMaxAltDigitLength = 5, kMaxCoreLeafNameLength = (kMaxFilenameLength - (kMaxAltDigitLength + 1)) }


static char * GetLastSeparator (const char *str, char sep)
PRUint32 CalculateAllocLength (PRUint32 logicalLength)
NS_NAMESPACE_PROTOTYPE void Canonify (nsSimpleCharString &ioPath, PRBool inMakeDirs)
NS_NAMESPACE_PROTOTYPE void MakeAllDirectories (const char *inPath, int mode)
NS_NAMESPACE_END nsresult ns_file_convert_result (PRInt32 nativeErr)
nsresult NS_FileSpecToIFile (nsFileSpec *fileSpec, nsILocalFile **result)

Define Documentation

#define DIR_SEPARATOR   '/'
#define DIR_STRCMP   strcmp

Enumeration Type Documentation

anonymous enum

Definition at line 312 of file nsFileSpec.cpp.

    {    kMaxFilenameLength = 31                // should work on Macintosh, Unix, and Win32.
    ,    kMaxAltDigitLength    = 5
    ,    kMaxCoreLeafNameLength    = (kMaxFilenameLength - (kMaxAltDigitLength + 1))

Function Documentation

PRUint32 CalculateAllocLength ( PRUint32  logicalLength) [inline]

Definition at line 259 of file nsFileSpec.cpp.

    return ((1 + (logicalLength >> 8)) << 8);

Here is the caller graph for this function:

static char* GetLastSeparator ( const char *  str,
char  sep 
) [inline, static]

Definition at line 65 of file nsFileSpec.cpp.

#if defined(XP_WIN) || defined(XP_OS2)
    return (char*) _mbsrchr((const unsigned char *) str, sep);
    return (char*) strrchr(str, sep);

Here is the call graph for this function:

Here is the caller graph for this function:

NS_NAMESPACE_PROTOTYPE void MakeAllDirectories ( const char *  inPath,
int  mode 

Definition at line 328 of file nsFileSpec.cpp.

    return nativeErr ?
        : NS_OK;

Definition at line 1330 of file nsFileSpec.cpp.

    nsresult rv;

    nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));

    if (!file) return NS_ERROR_FAILURE;

#if defined(XP_MAC)
        FSSpec spec  = fileSpec->GetFSSpec();
        nsCOMPtr<nsILocalFileMac> psmAppMacFile = do_QueryInterface(file, &rv);
        if (NS_FAILED(rv)) return rv;
        rv = psmAppMacFile->InitWithFSSpec(&spec);
        if (NS_FAILED(rv)) return rv;
        file = do_QueryInterface(psmAppMacFile, &rv);
    // XP_MACOSX: do this for OS X to preserve long filenames
    rv = file->InitWithNativePath(nsDependentCString(fileSpec->GetNativePathCString()));
    if (NS_FAILED(rv)) return rv;

    *result = file;
    return NS_OK;

Here is the call graph for this function:

Here is the caller graph for this function: