1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
17 //----------------------------------------------------------------------------
18 //------------------- Linux Sources of OSD_FileNode --------------------------
19 //----------------------------------------------------------------------------
23 #include <Standard_ProgramError.hxx>
24 #include <OSD_OSDError.hxx>
25 #include <Standard_NullObject.hxx>
26 #include <OSD_WhoAmI.hxx>
27 #include <OSD_FileNode.ixx>
29 #include <stdlib.h> // For "system"
37 const OSD_WhoAmI Iam = OSD_WFileNode;
40 // Create a file/directory object
42 OSD_FileNode::OSD_FileNode ()
46 // Create and initialize a file/directory object
48 OSD_FileNode::OSD_FileNode (const OSD_Path& Name)
55 // Get values of object
57 void OSD_FileNode::Path (OSD_Path& Name)const{
64 // Set values of object
66 void OSD_FileNode::SetPath (const OSD_Path& Name){
74 // Test if specified file/directory exists
76 Standard_Boolean OSD_FileNode::Exists(){
80 // if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
81 // OSD_OSDError::Raise("OSD_FileNode::Exists : no name was given"); (LD)
83 // if (Failed()) Perror();
85 TCollection_AsciiString aBuffer;
86 myPath.SystemName ( aBuffer );
87 status = access ( aBuffer.ToCString() , F_OK );
89 if (status == 0) return (Standard_True);
90 else return ( Standard_False );
96 // Physically remove a file/directory
98 void OSD_FileNode::Remove(){
100 // if (myPath.Name().Length()==0) A directory can have a null name field (ex: root)
101 // OSD_OSDError::Raise("OSD_FileNode::Remove : no name was given"); (LD)
103 // if (Failed()) Perror();
105 TCollection_AsciiString aBuffer;
106 myPath.SystemName ( aBuffer );
108 if(access(aBuffer.ToCString(), W_OK))
110 myError.SetValue (errno, Iam, "Remove");
114 struct stat stat_buf;
116 if(stat(aBuffer.ToCString(), &stat_buf))
118 myError.SetValue (errno, Iam, "Remove");
122 if ( S_ISDIR(stat_buf.st_mode)) {
125 if(rmdir(aBuffer.ToCString()))
127 myError.SetValue (errno, Iam, "Remove");
133 else if ( S_ISREG(stat_buf.st_mode) || S_ISLNK(stat_buf.st_mode) ||
134 S_ISFIFO(stat_buf.st_mode) ) {
136 if (unlink ( aBuffer.ToCString()) == -1)
137 myError.SetValue (errno, Iam, "Remove");
140 myError.SetValue (EINVAL, Iam, "Remove");
147 // Move a file/directory to another path
149 void OSD_FileNode::Move(const OSD_Path& NewPath){
151 TCollection_AsciiString thisPath;
153 // if (myPath.Name().Length()==0)
154 // OSD_OSDError::Raise("OSD_FileNode::Move : no name was given");
156 // if (Failed()) Perror();
158 NewPath.SystemName( thisPath ); // Get internal path name
159 TCollection_AsciiString aBuffer;
160 myPath.SystemName ( aBuffer );
161 status = rename (aBuffer.ToCString(), thisPath.ToCString());
163 if (status == -1) myError.SetValue (errno, Iam, "Move");
166 // Copy a file to another path and name
167 int static copy_file( const char* src, const char* trg )
171 int fds = open( src, O_RDONLY );
175 int fdo = open( trg, O_WRONLY|O_TRUNC| O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
183 const int BUFSIZE=4096;
186 while ( ( n = read ( fds, buf, BUFSIZE )) >0 )
188 if ( write ( fdo, buf, n ) != n ) { // writing error
203 void OSD_FileNode::Copy(const OSD_Path& ToPath)
206 TCollection_AsciiString second_name;
208 // if (myPath.Name().Length()==0) Copy .login would raise !!
209 // OSD_OSDError::Raise("OSD_FileNode::Copy : no name was given");
210 // if (Failed()) Perror();
212 ToPath.SystemName (second_name);
214 TCollection_AsciiString aBuffer;
215 myPath.SystemName ( aBuffer );
216 status = copy_file(aBuffer.ToCString(), second_name.ToCString());
217 if (status != 0) myError.SetValue (-1, Iam, "Copy failed") ;// (LD)
219 printf("Status %d : errno # %d\n",status,errno);
227 // Get protections of a file/directory
229 OSD_Protection OSD_FileNode::Protection(){
230 OSD_Protection thisProt;
235 // if (myPath.Name().Length()==0)
236 // OSD_OSDError::Raise("OSD_FileNode::Protection : no name was given");
238 // if (Failed()) Perror();
240 TCollection_AsciiString aBuffer;
241 myPath.SystemName ( aBuffer );
242 status = stat(aBuffer.ToCString(), &myStat);
243 if (status == -1) myError.SetValue (errno, Iam, "Protection");
245 u = g = w = OSD_None;
247 if (myStat.st_mode & S_IRUSR) u |= OSD_R;
248 if (myStat.st_mode & S_IWUSR) u |= OSD_W;
249 if (myStat.st_mode & S_IXUSR) u |= OSD_X;
251 if (myStat.st_mode & S_IRGRP) g |= OSD_R;
252 if (myStat.st_mode & S_IWGRP) g |= OSD_W;
253 if (myStat.st_mode & S_IXGRP) g |= OSD_X;
255 if (myStat.st_mode & S_IROTH) w |= OSD_R;
256 if (myStat.st_mode & S_IWOTH) w |= OSD_W;
257 if (myStat.st_mode & S_IXOTH) w |= OSD_X;
260 thisProt.SetValues ((OSD_SingleProtection)s,
261 (OSD_SingleProtection)u,
262 (OSD_SingleProtection)g,
263 (OSD_SingleProtection)w);
269 // Set protections of a file/directory
271 void OSD_FileNode::SetProtection(const OSD_Protection& Prot){
274 // if (myPath.Name().Length()==0)
275 // OSD_OSDError::Raise("OSD_FileNode::SetProtection : no name was given");
277 // if (Failed()) Perror();
279 TCollection_AsciiString aBuffer;
280 myPath.SystemName ( aBuffer );
281 status = chmod (aBuffer.ToCString(), (mode_t)Prot.Internal() );
282 if (status == -1) myError.SetValue (errno, Iam, "SetProtection");
289 Standard_Integer OSD_FileNode::UserId(){
292 // if (myPath.Name().Length()==0)
293 // OSD_OSDError::Raise("OSD_FileNode::UserId : no name was given");
295 // if (Failed()) Perror();
297 /* Get File Informations */
299 TCollection_AsciiString aBuffer;
300 myPath.SystemName ( aBuffer );
301 stat ( aBuffer.ToCString(), &buffer );
303 return ( buffer.st_uid );
309 Standard_Integer OSD_FileNode::GroupId(){
312 // if (myPath.Name().Length()==0)
313 // OSD_OSDError::Raise("OSD_FileNode::GroupId : no name was given");
315 // if (Failed()) Perror();
317 /* Get File Informations */
319 TCollection_AsciiString aBuffer;
320 myPath.SystemName ( aBuffer );
321 stat ( aBuffer.ToCString(), &buffer );
323 return ( buffer.st_gid );
329 // return the date of last access of file/directory
331 Quantity_Date OSD_FileNode::CreationMoment(){
333 Quantity_Date result;
337 // if (myPath.Name().Length()==0)
338 // OSD_OSDError::Raise("OSD_FileNode::CreationMoment : no name was given");
340 // if (Failed()) Perror();
342 /* Get File Informations */
344 TCollection_AsciiString aBuffer;
345 myPath.SystemName ( aBuffer );
346 if (!stat ( aBuffer.ToCString(), &buffer )) {
347 time_t aTime = (time_t)buffer.st_ctime;
348 decode = localtime (&aTime);
349 result.SetValues (decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
350 decode->tm_hour, decode->tm_min, decode->tm_sec , 0,0);
353 result.SetValues (1, 1, 1979, 0, 0, 0, 0, 0) ;
357 // return Last access of file/directory
359 Quantity_Date OSD_FileNode::AccessMoment(){
361 Quantity_Date result;
365 // if (myPath.Name().Length()==0)
366 // OSD_OSDError::Raise("OSD_FileNode::AccessMoment : no name was given");
368 // if (Failed()) Perror();
370 /* Get File Informations */
372 TCollection_AsciiString aBuffer;
373 myPath.SystemName ( aBuffer );
374 if (!stat ( aBuffer.ToCString(), &buffer )) {
375 time_t aTime = (time_t)buffer.st_ctime;
376 decode = localtime (&aTime);
377 result.SetValues (decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
378 decode->tm_hour, decode->tm_min, decode->tm_sec, 0,0 );
381 result.SetValues (1, 1, 1979, 0, 0, 0, 0, 0) ;
386 void OSD_FileNode::Reset(){
390 Standard_Boolean OSD_FileNode::Failed()const{
391 return( myError.Failed());
394 void OSD_FileNode::Perror() {
399 Standard_Integer OSD_FileNode::Error()const{
400 return( myError.Error());
405 //----------------------------------------------------------------------------
406 //------------------- WNT Sources of OSD_FileNode ---------------------------
407 //----------------------------------------------------------------------------
410 #include <OSD_FileNode.hxx>
411 #include <OSD_Protection.hxx>
412 #include <Quantity_Date.hxx>
413 #include <Standard_ProgramError.hxx>
414 #include <TCollection_ExtendedString.hxx>
416 #include <OSD_WNT_1.hxx>
422 #define TEST_RAISE( arg ) _test_raise ( fName, ( arg ) )
423 #define RAISE( arg ) Standard_ProgramError :: Raise ( ( arg ) )
425 PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, wchar_t* = NULL );
426 BOOL __fastcall _osd_wnt_sd_to_protection (
427 PSECURITY_DESCRIPTOR pSD, OSD_Protection& prot, BOOL
429 Standard_Integer __fastcall _get_file_type ( Standard_CString, HANDLE );
431 void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
433 static BOOL __fastcall _get_file_time ( Standard_ExtString, LPSYSTEMTIME, BOOL );
434 static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString );
436 //=======================================================================
437 //function : OSD_FileNode
438 //purpose : Empty Constructor
439 //=======================================================================
441 OSD_FileNode::OSD_FileNode ()
445 //=======================================================================
446 //function : OSD_FileNode
447 //purpose : Constructor
448 //=======================================================================
450 OSD_FileNode::OSD_FileNode ( const OSD_Path& Name )
453 } // end constructor ( 2 )
455 //=======================================================================
458 //=======================================================================
460 void OSD_FileNode::Path ( OSD_Path& Name ) const {
464 } // end OSD_FileNode :: Path
466 //=======================================================================
469 //=======================================================================
471 void OSD_FileNode::SetPath ( const OSD_Path& Name ) {
475 } // end OSD_FileNode :: SetPath
477 //=======================================================================
480 //=======================================================================
482 Standard_Boolean OSD_FileNode::Exists () {
484 Standard_Boolean retVal = Standard_False;;
485 TCollection_AsciiString fName;
487 myPath.SystemName ( fName );
489 if ( fName.IsEmpty () ) return Standard_False;
490 TEST_RAISE( "Exists" );
492 // make wide character string from UTF-8
493 TCollection_ExtendedString fNameW(fName);
494 if ( GetFileAttributesW ( (const wchar_t*) fNameW.ToExtString () ) == 0xFFFFFFFF ) {
496 if ( GetLastError () != ERROR_FILE_NOT_FOUND )
498 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
502 retVal = Standard_True;
506 } // end OSD_FileNode :: Exists
508 //=======================================================================
511 //=======================================================================
513 void OSD_FileNode::Remove () {
515 TCollection_AsciiString fName;
517 myPath.SystemName ( fName );
518 TCollection_ExtendedString fNameW(fName);
520 TEST_RAISE( "Remove" );
522 switch (_get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE)) {
526 if ( !DeleteFileW ( (const wchar_t*) fNameW.ToExtString () ) )
528 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
535 // LD : Suppression de l'appel a DeleteDirectory pour
536 // ne pas detruire un repertoire no vide.
538 if ( !RemoveDirectoryW ( (const wchar_t*) fNameW.ToExtString () ) )
540 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
546 RAISE( TEXT( "OSD_FileNode :: Remove ():"
547 " invalid file type - neither file nor directory" ) );
551 } // end OSD_FileNode :: Remove
553 //=======================================================================
556 //=======================================================================
558 void OSD_FileNode::Move ( const OSD_Path& NewPath ) {
560 TCollection_AsciiString fName;
561 TCollection_AsciiString fNameDst;
563 myPath.SystemName ( fName );
564 TCollection_ExtendedString fNameW(fName);
566 TEST_RAISE( "Move" );
568 NewPath.SystemName ( fNameDst );
569 TCollection_ExtendedString fNameDstW(fNameDst);
571 switch (_get_file_type (fName.ToCString (), INVALID_HANDLE_VALUE)) {
575 if (!MoveFileExW ((const wchar_t*)fNameW.ToExtString (),
576 (const wchar_t*)fNameDstW.ToExtString (),
577 MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
581 _osd_wnt_set_error ( myError, OSD_WFileNode,
582 fName.ToCString (), fNameDst.ToCString () );
587 if ( !MoveDirectory (
588 (const wchar_t*) fNameW.ToExtString (), (const wchar_t*) fNameDstW.ToExtString ()
592 _osd_wnt_set_error ( myError, OSD_WFileNode,
593 fName.ToCString (), fNameDst.ToCString () );
599 RAISE( TEXT( "OSD_FileNode :: Move (): "
600 "invalid file type - neither file nor directory" ) );
604 } // end OSD_FileNode :: Move
606 //=======================================================================
609 //=======================================================================
611 void OSD_FileNode::Copy ( const OSD_Path& ToPath ) {
613 TCollection_AsciiString fName;
614 TCollection_AsciiString fNameDst;
616 myPath.SystemName ( fName );
617 TCollection_ExtendedString fNameW(fName);
619 TEST_RAISE( "Copy" );
621 ToPath.SystemName ( fNameDst );
622 TCollection_ExtendedString fNameDstW(fNameDst);
624 switch (_get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE)) {
628 if (!CopyFileW ((const wchar_t*)fNameW.ToExtString (),
629 (const wchar_t*)fNameDstW.ToExtString (), FALSE ))
630 _osd_wnt_set_error (myError, OSD_WFileNode,
631 fName.ToCString (), fNameDst.ToCString ());
636 if ( !CopyDirectory (
637 (const wchar_t*)fNameW.ToExtString (), (const wchar_t*)fNameDstW.ToExtString ()
642 myError, OSD_WFileNode, fName.ToCString (), fNameDst.ToCString ()
649 RAISE( TEXT( "OSD_FileNode :: Copy ():"
650 " invalid file type - neither file nor directory" ) );
654 } // end OSD_FileNode :: Copy
656 //=======================================================================
657 //function : Protection
659 //=======================================================================
661 OSD_Protection OSD_FileNode::Protection () {
663 OSD_Protection retVal;
664 TCollection_AsciiString fName;
665 PSECURITY_DESCRIPTOR pSD;
667 myPath.SystemName ( fName );
668 TCollection_ExtendedString fNameW(fName);
670 TEST_RAISE( "Protection" );
672 if ( ( pSD = GetFileSecurityEx (
673 (const wchar_t*) fNameW.ToExtString (), DACL_SECURITY_INFORMATION |
674 OWNER_SECURITY_INFORMATION
677 !_osd_wnt_sd_to_protection (
679 _get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE) == FLAG_DIRECTORY)
682 _osd_wnt_set_error ( myError, OSD_WFileNode );
686 FreeFileSecurity ( pSD );
690 } // end OSD_FileNode :: Protection
692 //=======================================================================
693 //function : SetProtection
695 //=======================================================================
697 void OSD_FileNode::SetProtection ( const OSD_Protection& Prot ) {
699 TCollection_AsciiString fName;
700 PSECURITY_DESCRIPTOR pSD;
702 myPath.SystemName ( fName );
703 TCollection_ExtendedString fNameW(fName);
705 TEST_RAISE( "SetProtection" );
707 pSD = _osd_wnt_protection_to_sd (
709 _get_file_type (fName.ToCString(), INVALID_HANDLE_VALUE) ==
711 (wchar_t *)fNameW.ToExtString ()
714 if ( pSD == NULL || !SetFileSecurityW (
715 (const wchar_t*) fNameW.ToExtString (), DACL_SECURITY_INFORMATION, pSD
719 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
725 } // end OSD_FileNode :: SetProtection
727 //=======================================================================
728 //function : AccessMoment
730 //=======================================================================
732 Quantity_Date OSD_FileNode::AccessMoment () {
734 Quantity_Date retVal;
735 SYSTEMTIME stAccessMoment;
736 SYSTEMTIME stAccessSystemMoment;
737 TCollection_AsciiString fName;
739 myPath.SystemName ( fName );
740 TCollection_ExtendedString fNameW(fName);
742 TEST_RAISE( "AccessMoment" );
744 // if ( _get_file_time ( fName.ToCString (), &stAccessMoment, TRUE ) )
745 if ( _get_file_time ( fNameW.ToExtString (), &stAccessSystemMoment, TRUE ) )
748 SYSTEMTIME * aSysTime = &stAccessMoment;
749 BOOL aFlag = SystemTimeToTzSpecificLocalTime (NULL ,
750 &stAccessSystemMoment ,
752 if (aFlag == 0) // AGV: test for success (e.g., unsupported on Win95/98)
753 aSysTime = &stAccessSystemMoment;
754 retVal.SetValues (aSysTime->wMonth, aSysTime->wDay,
755 aSysTime->wYear, aSysTime->wHour,
756 aSysTime->wMinute, aSysTime->wSecond,
757 aSysTime->wMilliseconds
762 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
766 } // end OSD_FileNode :: AccessMoment
768 //=======================================================================
769 //function : CreationMoment
771 //=======================================================================
773 Quantity_Date OSD_FileNode::CreationMoment () {
775 Quantity_Date retVal;
776 SYSTEMTIME stCreationMoment;
777 SYSTEMTIME stCreationSystemMoment;
778 TCollection_AsciiString fName;
780 myPath.SystemName ( fName );
781 TCollection_ExtendedString fNameW(fName);
783 TEST_RAISE( "CreationMoment" );
785 // if ( _get_file_time ( fName.ToCString (), &stCreationMoment, FALSE ) )
786 if ( _get_file_time ( fNameW.ToExtString (), &stCreationSystemMoment, TRUE ) )
789 SYSTEMTIME * aSysTime = &stCreationMoment;
790 BOOL aFlag = SystemTimeToTzSpecificLocalTime (NULL,
791 &stCreationSystemMoment ,
793 if (aFlag == 0) // AGV: test for success (e.g., unsupported on Win95/98)
794 aSysTime = &stCreationSystemMoment;
795 retVal.SetValues (aSysTime->wMonth, aSysTime->wDay,
796 aSysTime->wYear, aSysTime->wHour,
797 aSysTime->wMinute, aSysTime->wSecond,
798 aSysTime->wMilliseconds
803 _osd_wnt_set_error ( myError, OSD_WFileNode, fName.ToCString () );
807 } // end OSD_FileNode :: CreationMoment
809 //=======================================================================
812 //=======================================================================
814 Standard_Integer OSD_FileNode::UserId () {
816 PSID pSIDowner = NULL;
819 TCollection_AsciiString fName;
820 PSECURITY_DESCRIPTOR pSD;
822 myPath.SystemName ( fName );
823 TCollection_ExtendedString fNameW(fName);
825 TEST_RAISE( "UserId" );
827 if ( ( pSD = GetFileSecurityEx (
828 (const wchar_t*) fNameW.ToExtString (),
829 OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
832 GetSecurityDescriptorOwner ( pSD, &pSIDowner, &fDefaulted ) &&
836 retVal = CopySidEx ( pSIDowner );
840 _osd_wnt_set_error ( myError, OSD_WFileNode );
844 FreeFileSecurity ( pSD );
846 return ( Standard_Integer )retVal;
848 } // end OSD_FileNode :: UserId
850 //=======================================================================
853 //=======================================================================
855 Standard_Integer OSD_FileNode::GroupId () {
857 PGROUP_SID retVal = NULL;
858 TCollection_AsciiString fName;
859 PSECURITY_DESCRIPTOR pSD;
861 myPath.SystemName ( fName );
862 TCollection_ExtendedString fNameW(fName);
864 TEST_RAISE( "GroupId" );
866 if ( ( pSD = GetFileSecurityEx (
867 (const wchar_t*) fNameW.ToExtString (),
868 OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION
873 retVal = AllocGroupSid ( pSD );
874 FreeFileSecurity ( pSD );
878 _osd_wnt_set_error ( myError, OSD_WFileNode );
880 return ( Standard_Integer )retVal;
882 } // end OSD_FileNode :: GroupId
884 //=======================================================================
887 //=======================================================================
889 Standard_Boolean OSD_FileNode::Failed () const {
891 return myError.Failed ();
893 } // end OSD_FileNode :: Failed
895 //=======================================================================
898 //=======================================================================
900 void OSD_FileNode::Reset () {
904 } // end OSD_FileNode :: Reset
906 //=======================================================================
909 //=======================================================================
911 void OSD_FileNode::Perror () {
915 } // end OSD_FileNode :: Perror
917 //=======================================================================
920 //=======================================================================
922 Standard_Integer OSD_FileNode::Error () const {
924 return myError.Error ();
926 } // end OSD_FileNode :: Error
928 void _osd_wnt_set_error ( OSD_Error& err, OSD_WhoAmI who, ... ) {
931 Standard_Character buffer[ 2048 ];
934 va_start ( arg_ptr, err );
936 errCode = GetLastError ();
938 if ( !FormatMessage (
939 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
940 0, errCode, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ),
941 buffer, 2048, &arg_ptr
945 sprintf ( buffer, "error code %d", (Standard_Integer)errCode );
946 SetLastError ( errCode );
950 err.SetValue ( errCode, who, buffer );
956 #if defined(__CYGWIN32__) || defined(__MINGW32__)
959 #define __leave return retVal
962 static BOOL __fastcall _get_file_time (
963 Standard_ExtString fName, LPSYSTEMTIME lpSysTime, BOOL fAccess
967 FILETIME ftCreationTime;
968 FILETIME ftLastWriteTime;
970 HANDLE hFile = INVALID_HANDLE_VALUE;
974 if ( ( hFile = CreateFileW ((const wchar_t*) fName, 0, 0,
975 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
976 ) == INVALID_HANDLE_VALUE
979 if ( !GetFileTime ( hFile, &ftCreationTime, NULL, &ftLastWriteTime ) ) __leave;
981 lpftPtr = fAccess ? &ftLastWriteTime : &ftCreationTime;
983 if ( !FileTimeToSystemTime ( lpftPtr, lpSysTime ) ) __leave;
991 if ( hFile != INVALID_HANDLE_VALUE )
993 CloseHandle ( hFile );
998 leave: ; // added for VisualAge
1003 } // end _get_file_time
1005 #if defined(__CYGWIN32__) || defined(__MINGW32__)
1011 static void __fastcall _test_raise ( TCollection_AsciiString fName, Standard_CString str ) {
1013 Standard_Character buff[ 64 ];
1015 if ( fName.IsEmpty () ) {
1017 strcpy ( buff, "OSD_FileNode :: " );
1018 strcat ( buff, str );
1019 strcat ( buff, " (): wrong access" );
1021 Standard_ProgramError :: Raise ( buff );
1025 } // end _test_raise