home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 23.4 KB | 784 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLFileSp.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
- #ifndef FWFILESY_H
- #include "FWFileSy.h"
- #endif
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- #ifndef SLFILPAR_H
- #include "SLFilPar.h"
- #endif
-
- #ifndef FWBNDSTR_H
- #include "FWBndStr.h"
- #endif
-
- #ifndef SLFILESY_H
- #include "SLFileSy.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__ERRORS__)
- #include <Errors.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__FINDER__)
- #include <Finder.h>
- #endif
-
- #if defined(FW_BUILD_WIN) && !defined(__IO_H)
- #include <io.h>
- #endif
-
- /*
- * This file was generated by the SOM Compiler.
- * Generated using:
- * SOM Emitter emitxtm.dll: 2.33
- */
-
- #define FW_OFileSpecification_Class_Source
- #define FW_ODirectorySpecification_Class_Source
- #include "SLFileSp.xih"
-
-
- #ifdef FW_BUILD_MAC
- #pragma segment File
- #endif
-
- //----------------------------------------------------------------------------------------
- // Forward definitions
- //----------------------------------------------------------------------------------------
-
- static void failOnError(short theError);
-
-
- //========================================================================================
- // FW_CPrivFileSpecification
- // This struct contains the private implementation for FW_OFileSpecification
- //========================================================================================
-
- class FW_CPrivFileSpecification
- {
- #ifdef FW_BUILD_WIN
- public:
- FW_DECLARE_AUTO(FW_CPrivFileSpecification);
-
- FW_CString fFileInfo;
- #endif
-
- #ifdef FW_BUILD_MAC
- public:
- FW_CPrivFileSpecification() :
- fFileType(FW_kDefaultFileType),
- fCreatorType(FW_kDefaultCreatorType)
- {
- fFileInfo.vRefNum = 0;
- fFileInfo.parID = 0;
- fFileInfo.name[0] = 0;
- }
-
- FSSpec fFileInfo;
- OSType fFileType;
- OSType fCreatorType;
- #endif
- };
-
-
- #ifdef FW_BUILD_WIN
- FW_DEFINE_AUTO(FW_CPrivFileSpecification);
- #endif
-
-
-
- //========================================================================================
- // class FW_OFileSpecification
- //========================================================================================
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__InitFromFileName
- // Create a file specification from a full or partial pathname. In the case of
- // a partial pathname, the specification will use the current default
- // directory to build a full pathname.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__InitFromFileName(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString fileName)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_CString fileNameStr(fileName);
-
- #ifdef FW_BUILD_WIN
- rep.fFileInfo = fileNameStr;
- FW_PrivFileSystemParser_WinExpandPartialPath(rep.fFileInfo);
-
- // Verify that path exists.
- FW_CString tempString;
- if (!FW_PrivFileSystemParser_WinGetPathName(rep.fFileInfo, tempString))
- failOnError(FW_xPathNotFound);
-
- FW_SOMEnvironment ev;
- if (!FW_PrivFileSystem_WinPathExists(ev, tempString))
- failOnError(FW_xPathNotFound);
- #endif
-
- #ifdef FW_BUILD_MAC
- FW_PlatformError theError = FW_xNoError;
- Str255 macFileName;
-
- rep.fFileType = FW_kDefaultFileType;
- rep.fCreatorType = FW_kDefaultCreatorType;
-
- fileNameStr.ExportPascal(macFileName);
-
- theError = ::FSMakeFSSpec(0, 0, macFileName, &rep.fFileInfo);
- if ((theError != FW_xNoError) && (theError != FW_xNoFileFound))
- {
- rep.fFileInfo.vRefNum = 0;
- rep.fFileInfo.parID = 0;
- FW_ASSERT(fileNameStr.GetByteLength() < 64);
- fileNameStr.ExportPascal(rep.fFileInfo.name);
- FW_Failure(theError);
- }
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__InitFromDirectoryAndName
- // Create a file specification from a directory and a file name. The file name
- // should include any extensions that might be necessary.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__InitFromDirectoryAndName(FW_OFileSpecification *somSelf, Environment *ev,
- FW_ODirectorySpecification* directory,
- FW_HString fileName)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString fileNameStr(fileName);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- #ifdef FW_BUILD_WIN
- directory->GetFullPath(ev, rep.fFileInfo);
-
- if (fileNameStr.GetByteLength() > 0)
- FW_PrivFileSystemParser_AddDelimiter(rep.fFileInfo);
-
- rep.fFileInfo += fileNameStr;
-
- // Verify that path exists.
- FW_CString tempString;
- if (!FW_PrivFileSystemParser_WinGetPathName(rep.fFileInfo, tempString))
- failOnError(FW_xPathNotFound);
-
- FW_SOMEnvironment ev;
- if (!FW_PrivFileSystem_WinPathExists(ev, tempString))
- failOnError(FW_xPathNotFound);
- #endif
-
- #ifdef FW_BUILD_MAC
- FW_PlatformError theError = FW_xNoError;
- Str255 macFileName;
- FW_CString255 partialPathName;
-
- rep.fFileType = FW_kDefaultFileType;
- rep.fCreatorType = FW_kDefaultCreatorType;
-
- directory->MacGetFSSpec(ev, &rep.fFileInfo);
- partialPathName.ReplaceAll((FW_PascalChar*)&rep.fFileInfo.name);
- partialPathName.Prepend(&FW_kPathDelimiter, 1);
-
- FW_PrivFileSystemParser_AddDelimiter(partialPathName);
- partialPathName += fileNameStr;
- partialPathName.ExportPascal(macFileName);
-
- theError = ::FSMakeFSSpec(rep.fFileInfo.vRefNum, rep.fFileInfo.parID, macFileName, &rep.fFileInfo);
- if ((theError != FW_xNoError) && (theError != FW_xNoFileFound))
- {
- FSSpec dirFSSpec;
- directory->MacGetFSSpec(ev, &dirFSSpec);
-
- rep.fFileInfo.vRefNum = dirFSSpec.vRefNum;
- rep.fFileInfo.parID = dirFSSpec.parID;
-
- FW_ASSERT(fileNameStr.GetByteLength() < 64);
- partialPathName.ExportPascal(rep.fFileInfo.name);
-
- FW_Failure(theError);
- }
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__GetName
- // Get the name of the file.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__GetName(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString* fileName)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString fileNameStr(*fileName);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- // FW_PlatformError theError = FW_xNoError;
-
- #ifdef FW_BUILD_WIN
- FW_CString parsedName;
-
- if (FW_PrivFileSystemParser_GetFileName(rep.fFileInfo, parsedName))
- fileNameStr = parsedName;
- else
- failOnError(FW_kBadFileName);
- #endif
-
- #ifdef FW_BUILD_MAC
- fileNameStr.ReplaceAll(rep.fFileInfo.name);
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__GetParentDirectory
- // Returns the path information for this file.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope FW_ODirectorySpecification* SOMLINK FW_OFileSpecification__GetParentDirectory(FW_OFileSpecification *somSelf, Environment *ev)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_ODirectorySpecification* returnDirectory = new FW_ODirectorySpecification;
-
- #ifdef FW_BUILD_WIN
- FW_CString tempPathName;
-
- if (FW_PrivFileSystemParser_WinGetPathName(rep.fFileInfo, tempPathName))
- {
- returnDirectory->InitFromFileName(ev, tempPathName);
- }
- else
- {
- // Path should already have been verified.
- failOnError(FW_xPathNotFound);
- }
- #endif
-
- #ifdef FW_BUILD_MAC
- failOnError(FW_PrivFileSystemParser_MacGenerateDirectory(rep.fFileInfo.vRefNum, rep.fFileInfo.parID, returnDirectory));
- #endif
-
- return returnDirectory;
- }
- FW_SOM_CATCH
- return 0;
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__GetFullPath
- // Returns the fully qualified path and file name for this file. The user should
- // pass in a dynamic string so as to guarantee that the path will fit inside
- // it.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__GetFullPath(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString* fullPathName)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString fullPathNameStr(*fullPathName);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- #ifdef FW_BUILD_WIN
- fullPathNameStr = rep.fFileInfo;
- #endif
-
- #ifdef FW_BUILD_MAC
- fullPathNameStr.ReplaceAll(rep.fFileInfo.name);
- FW_PlatformError theError = FW_xNoError;
-
- theError = FW_PrivFileSystemParser_MacGenerateFullPathName(rep.fFileInfo.vRefNum, rep.fFileInfo.parID, fullPathNameStr);
- failOnError(theError);
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__IsSameAs
- // Does this file represent the same file as theOtherFile.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope FW_Boolean SOMLINK FW_OFileSpecification__IsSameAs(FW_OFileSpecification *somSelf, Environment *ev,
- FW_OFileSpecification* theOtherFile)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_CPrivFileSpecification& otherRep = *FW_OFileSpecificationGetData(theOtherFile)->fRep;
-
- #ifdef FW_BUILD_WIN
- FW_CString tempString1(rep.fFileInfo);
- FW_CString tempString2(otherRep.fFileInfo);
-
- tempString1.ToUpper();
- tempString2.ToUpper();
- return (tempString1 == tempString2);
- #endif
-
- #ifdef FW_BUILD_MAC
- if ((rep.fFileInfo.vRefNum == otherRep.fFileInfo.vRefNum) && (rep.fFileInfo.parID == otherRep.fFileInfo.parID))
- {
- if (rep.fFileType == otherRep.fFileType && rep.fCreatorType == otherRep.fCreatorType)
- {
- // [jkp] this is a clumsy way to do the comparison. Can the strings be inited
- // with the fFileInfo.name fields?
- FW_CString fileName1;
- FW_CString fileName2;
-
- fileName1.ReplaceAll((FW_PascalChar*)&rep.fFileInfo.name);
- fileName2.ReplaceAll((FW_PascalChar*)&otherRep.fFileInfo.name);
-
- fileName1.ToUpper();
- fileName2.ToUpper();
- return (fileName1 == fileName2);
- }
- }
-
- return (FALSE);
- #endif
- }
- FW_SOM_CATCH
- return 0;
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__AssignOFileSpecification
- // Copy all of the file information from theOtherFile so that this file spec
- // represents the same file.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__AssignOFileSpecification(FW_OFileSpecification *somSelf, Environment *ev,
- FW_OFileSpecification* theOtherFile)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_CPrivFileSpecification& otherRep = *FW_OFileSpecificationGetData(theOtherFile)->fRep;
-
- rep.fFileInfo = otherRep.fFileInfo;
- #ifdef FW_BUILD_MAC
- rep.fFileType = otherRep.fFileType;
- rep.fCreatorType = otherRep.fCreatorType;
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__AssignFileName
- // Change the name of this file to fileName. fileName may be a partial pathName.
- // This does not change any of the existing path information.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__AssignFileName(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString fileNameRep)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString fileName(fileNameRep);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- #ifdef FW_BUILD_WIN
- FW_CString tempPathName;
-
- if (FW_PrivFileSystemParser_WinGetPathName(rep.fFileInfo, tempPathName))
- {
- FW_PrivFileSystemParser_AddDelimiter(tempPathName);
- rep.fFileInfo = tempPathName;
- }
-
- rep.fFileInfo += fileName;
-
- // Verify that path exists.
- FW_CString tempString;
- if (!FW_PrivFileSystemParser_WinGetPathName(rep.fFileInfo, tempString))
- failOnError(FW_xPathNotFound);
-
- FW_SOMEnvironment ev;
- if (!FW_PrivFileSystem_WinPathExists(ev, tempString))
- failOnError(FW_xPathNotFound);
- #endif
-
- #ifdef FW_BUILD_MAC
- FW_PlatformError theError = FW_xNoError;
- short vRefNum = rep.fFileInfo.vRefNum;
- long dirID = rep.fFileInfo.parID;
- Str255 macFileName;
-
- rep.fFileType = FW_kDefaultFileType;
- rep.fCreatorType = FW_kDefaultCreatorType;
-
- fileName.ExportPascal(macFileName);
-
- theError = ::FSMakeFSSpec(vRefNum, dirID, macFileName, &rep.fFileInfo);
- if ((theError != FW_xNoError) && (theError != FW_xNoFileFound))
- {
- rep.fFileInfo.vRefNum = vRefNum;
- rep.fFileInfo.parID = dirID;
- FW_ASSERT(fileName.GetByteLength() < 64);
- fileName.ExportPascal(rep.fFileInfo.name);
- FW_Failure(theError);
- }
- #endif
- }
- FW_SOM_CATCH
- }
-
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__WinGetDrive
- //----------------------------------------------------------------------------------------
-
- SOM_Scope char SOMLINK FW_OFileSpecification__WinGetDrive(FW_OFileSpecification *somSelf, Environment *ev)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_CharacterPosition colonPosition = -1;
- FW_CString driveName;
- FW_Char driveLetter = '\0';
-
- // If there's no drive information in the path, get the default drive information.
- if (!FW_PrivFileSystemParser_WinGetDrivePath(rep.fFileInfo, driveName))
- failOnError(FW_kBadFileName);
-
- if (!driveName.FindCharacter(FW_kDriveDelimiter, colonPosition))
- failOnError(FW_kNoSuchVolume);
-
- if (colonPosition > 1)
- failOnError(FW_kNoSuchVolume);
-
- driveName.ToLower();
-
- driveLetter = (char) driveName[(FW_CharacterPosition)(colonPosition - 1)];
-
- if ((driveLetter < 'a') || (driveLetter > 'z'))
- failOnError(FW_kBadFileName);
-
- return (driveLetter);
- }
- FW_SOM_CATCH
- return 0;
- }
- #endif
-
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__WinGetExtension
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__WinGetExtension(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString* extension)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString extensionStr(*extension);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- if (!FW_PrivFileSystemParser_GetExtension(rep.fFileInfo, extensionStr))
- extensionStr = "";
- }
- FW_SOM_CATCH
- }
- #endif
-
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__WinSetExtension
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__WinSetExtension(FW_OFileSpecification *somSelf, Environment *ev,
- FW_HString extension)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_TRY
- {
- FW_CString extensionStr(extension);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
- FW_CString newFileInfo;
-
- FW_PrivFileSystemParser_ChangeExtension(rep.fFileInfo, extensionStr, newFileInfo);
- rep.fFileInfo = newFileInfo;
- }
- FW_SOM_CATCH
- }
- #endif
-
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__AssignFileSpec
- // This specifier will now represent the file described by macSpec.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__AssignFileSpec(FW_OFileSpecification *somSelf, Environment *ev,
- FSSpec* macSpec)
- {
- FW_UNUSED(ev);
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- rep.fFileInfo = *macSpec;
- rep.fFileType = FW_kDefaultFileType;
- rep.fCreatorType = FW_kDefaultCreatorType;
- }
- #endif
-
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__MacGetFSSpec
- // Return a Macintosh FSSpec that points to this file.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__MacGetFSSpec(FW_OFileSpecification *somSelf, Environment *ev,
- FSSpec* macSpec)
- {
- FW_UNUSED(ev);
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- *macSpec = rep.fFileInfo;
- }
- #endif
-
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__MacSetTypeAndCreator
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__MacSetTypeAndCreator(FW_OFileSpecification *somSelf, Environment *ev,
- FW_ResourceType aFileType,
- FW_ResourceType aCreatorType)
- {
- FW_UNUSED(ev);
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- rep.fFileType = aFileType;
- rep.fCreatorType = aCreatorType;
- }
- #endif
-
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__MacGetTypeAndCreator
- // Accessors to the type and creator of the file specification.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__MacGetTypeAndCreator(FW_OFileSpecification *somSelf, Environment *ev,
- FW_ResourceType* aFileType,
- FW_ResourceType* aCreatorType)
- {
- FW_UNUSED(ev);
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
- FW_CPrivFileSpecification& rep = *somThis->fRep;
-
- *aFileType = rep.fFileType;
- *aCreatorType = rep.fCreatorType;
- }
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__somInit
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__somInit(FW_OFileSpecification *somSelf)
- {
- FW_UNUSED(somSelf);
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- // FW_OFileSpecification_parent_SOMObject_somInit(somSelf);
-
- somThis->fRep = new FW_CPrivFileSpecification;
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_OFileSpecification__somUninit
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_OFileSpecification__somUninit(FW_OFileSpecification *somSelf)
- {
- FW_OFileSpecificationData *somThis = FW_OFileSpecificationGetData(somSelf);
-
- FW_SOM_UNINIT_TRY
- {
- delete somThis->fRep;
-
- // FW_OFileSpecification_parent_SOMObject_somUninit(somSelf);
- }
- FW_SOM_UNINIT_CATCH
- }
-
-
-
- //========================================================================================
- // class FW_ODirectorySpecification
- //========================================================================================
-
-
- //----------------------------------------------------------------------------------------
- // FW_ODirectorySpecification__AppendDirectoryName
- // Add directoryName to the end of this path. This routine will add a path
- // separator so that the user does not need to. The remaining path information
- // may specify a subdirectory or parent directory, but must start from this
- // directory.
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_ODirectorySpecification__AppendDirectoryName(FW_ODirectorySpecification *somSelf, Environment *ev,
- FW_HString directoryNameRep)
- {
- /* FW_ODirectorySpecificationData *somThis = FW_ODirectorySpecificationGetData(somSelf); */
- FW_ODirectorySpecificationMethodDebug("FW_ODirectorySpecification","FW_ODirectorySpecification__AppendDirectoryName");
-
- FW_SOM_TRY
- {
- FW_CString directoryName(directoryNameRep);
- FW_CString tempName;
-
- // Get our current name
- somSelf->GetName(ev, tempName);
-
- #ifdef FW_BUILD_MAC
- // Need to add a leading delimiter to indicate this is a partial path.
- tempName.Prepend(&FW_kPathDelimiter, 1);
- #endif
-
- tempName += FW_kPathDelimiter;
- tempName += directoryName;
-
- // Set the name to that new string
- somSelf->AssignFileName(ev, tempName);
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_ODirectorySpecification__GetFullPath
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_ODirectorySpecification__GetFullPath(FW_ODirectorySpecification *somSelf, Environment *ev,
- FW_HString* fullPathName)
- {
- /* FW_ODirectorySpecificationData *somThis = FW_ODirectorySpecificationGetData(somSelf); */
- FW_ODirectorySpecificationMethodDebug("FW_ODirectorySpecification","FW_ODirectorySpecification__GetFullPath");
-
- FW_SOM_TRY
- {
- FW_CString fullPathNameStr(*fullPathName);
- FW_ODirectorySpecification_parent_FW_OFileSpecification_GetFullPath(somSelf,ev,fullPathNameStr);
- FW_PrivFileSystemParser_AddDelimiter(fullPathNameStr);
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_ODirectorySpecification__somInit
- //----------------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK FW_ODirectorySpecification__somInit(FW_ODirectorySpecification *somSelf)
- {
- // FW_ODirectorySpecificationData *somThis = FW_ODirectorySpecificationGetData(somSelf);
- FW_ODirectorySpecificationMethodDebug("FW_ODirectorySpecification","FW_ODirectorySpecification__somInit");
-
- // FW_ODirectorySpecification_parent_FW_OFileSpecification_somInit(somSelf);
-
- // Assign the null directory to this item
- FW_SOMEnvironment ev;
-
- FW_SOM_TRY
- {
- FW_CString nullPath;
- somSelf->InitFromFileName(ev, nullPath);
- }
- FW_SOM_CATCH
- }
-
-
- //----------------------------------------------------------------------------------------
- // failOnError
- //----------------------------------------------------------------------------------------
-
- static void failOnError(short theError)
- {
- // JEL: I don't know why kNoFileFound is not an error.
- // Ideally, we should eliminate this method entirely, and just
- // call FW_FailOnError directly, and only check for kNoFileFound
- // where it is definitely not an error.
- if (theError != FW_xNoFileFound)
- FW_FailOnError(theError);
- }
-