View Issue Details

IDProjectCategoryView StatusLast Update
0030769CommunityOCCT:Foundation Classespublic2019-07-08 14:08
ReporterVico Liang Assigned Tobugmaster  
PrioritynormalSeverityblock 
Status closedResolutionno change required 
Product Version7.4.0 
Target Version7.4.0 
Summary0030769: OSD_FileNode::Exists () doesn't work properly on uwp
DescriptionThe function of below are latest git version, it will return false for file actually exist on uwp. It can be reproduced on windows 10 uwp simulator. The problem occurs in function GetFileAttributesExW which retuning false. Due to this issue, it's impossible to open and save ocaf document on uwp.

Standard_Boolean OSD_FileNode::Exists ()
{
  myError.Reset();

 Standard_Boolean retVal = Standard_False;;
 TCollection_AsciiString fName;

 myPath.SystemName ( fName );

 if ( fName.IsEmpty () ) return Standard_False;
 TEST_RAISE( "Exists" );

 // make wide character string from UTF-8
 TCollection_ExtendedString fNameW(fName);

 WIN32_FILE_ATTRIBUTE_DATA aFileInfo;

 if (!GetFileAttributesExW (fNameW.ToWideString(), GetFileExInfoStandard, &aFileInfo))
 {
  if (GetLastError() != ERROR_FILE_NOT_FOUND)
  {
    _osd_wnt_set_error (myError, OSD_WFileNode, fNameW.ToWideString());
  }
 }
 else
 {
  retVal = Standard_True;
 }

 return retVal;

} // end OSD_FileNode :: Exists
TagsNo tags attached.
Test case number

Relationships

related to 0030770 closedbugmaster Foundation Classes - OSD_OpenFile always fails to open file on UWP 
related to 0030761 closedbugmaster Application Framework - HOMEDRIVE and TEMP are undefined on UWP 

Activities

Vico Liang

2019-06-05 17:57

developer   ~0084898

Below function is affected due to this issue. It will always returning false even if the folder exist.

Standard_Boolean CDF_FWOSDriver::Find(const TCollection_ExtendedString& aFolder,
                                         const TCollection_ExtendedString& aName,
                                         const TCollection_ExtendedString& /*aVersion*/)
{

  OSD_Path thePath=UTL::Path(aFolder);
  OSD_Directory theDirectory(thePath);
  if(theDirectory.Exists()) {
    TCollection_ExtendedString f(aFolder);
    PutSlash(f);
    f+=aName;
    OSD_Path p2 = UTL::Path(f);
    OSD_File theFile(p2);
    return theFile.Exists();
  }
  return Standard_False;
}

Vico Liang

2019-06-06 05:39

developer   ~0084903

Last edited: 2019-06-06 05:41

This is not an occt issue, it's about UWP file accessing restriction. UWP don't allow file accessing outside sandbox. If the file inside sandbox, it will work. so this issue can be closed.

kgv

2019-06-24 09:25

developer   ~0085241

Dear Bugmaster,

please close the issue.

Issue History

Date Modified Username Field Change
2019-06-05 17:51 Vico Liang New Issue
2019-06-05 17:51 Vico Liang Assigned To => abv
2019-06-05 17:53 Vico Liang Relationship added related to 0030761
2019-06-05 17:57 Vico Liang Note Added: 0084898
2019-06-06 05:39 Vico Liang Note Added: 0084903
2019-06-06 05:39 Vico Liang Note Edited: 0084903
2019-06-06 05:41 Vico Liang Note Edited: 0084903
2019-06-24 09:25 kgv Relationship added related to 0030770
2019-06-24 09:25 kgv Note Added: 0085241
2019-06-24 09:25 kgv Assigned To abv => bugmaster
2019-06-24 09:25 kgv Status new => feedback
2019-06-24 09:25 kgv Resolution open => no change required
2019-07-08 14:08 bugmaster Status feedback => closed