MantisBT - Community
View Issue Details
0030761Community[OCCT] OCCT:Application Frameworkpublic2019-06-02 18:392019-06-16 11:39
Vico Liang 
bugmaster 
normalblock 
closedfixed 
[OCCT] 7.1.0 
[OCCT] 7.4.0[OCCT] 7.4.0 
Not required
0030761: Application Framework - HOMEDRIVE and TEMP are undefined on UWP
It's impossible to save or open any document of OCAF. There are exception in below function, HOMEDRIVE and TEMP environment are undefined on UWP.

TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder()
{
  TCollection_ExtendedString theDefaultFolder;
  if (theDefaultFolder.Length() == 0) {
    
#ifdef _WIN32
    TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE");
    if(hd.Length() != 0) {
      theDefaultFolder=hd;
      theDefaultFolder+=UTL::xgetenv("HOMEPATH");
    }
    else {
      theDefaultFolder=UTL::xgetenv("TEMP");
      if(theDefaultFolder.Length()==0)
        throw Standard_Failure("cannot determine default folder; HOMEDRIVE and TEMP are undefined");
    }
#else
    TCollection_ExtendedString home=UTL::xgetenv("HOME");
    if(home.Length() !=0)
      theDefaultFolder = home;
    else
      theDefaultFolder= TCollection_ExtendedString("/tmp");
#endif
  }
  return theDefaultFolder;
}
Not required
No tags attached.
related to 0030769closed bugmaster Community OSD_FileNode::Exists () doesn't work properly on uwp 
Issue History
2019-06-02 18:39Vico LiangNew Issue
2019-06-02 18:39Vico LiangAssigned To => mpv
2019-06-03 04:31Vico LiangSeverityminor => block
2019-06-03 16:06gitNote Added: 0084770
2019-06-03 16:27kgvRelationship addedchild of 0027350
2019-06-03 16:28kgvProduct Version7.4.0 => 7.1.0
2019-06-03 16:28kgvSummaryHOMEDRIVE and TEMP are undefined on UWP => Application Framework - HOMEDRIVE and TEMP are undefined on UWP
2019-06-03 17:55Vico LiangNote Added: 0084772
2019-06-03 17:57Vico LiangNote Edited: 0084772bug_revision_view_page.php?bugnote_id=84772#r21296
2019-06-04 08:15Vico LiangNote Added: 0084789
2019-06-04 12:17mpvNote Added: 0084802
2019-06-04 18:56Vico LiangNote Added: 0084825
2019-06-05 09:47mpvNote Added: 0084842
2019-06-05 09:47mpvAssigned Tompv => szy
2019-06-05 09:47mpvStatusnew => resolved
2019-06-05 09:47mpvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21312#r21312
2019-06-05 17:53Vico LiangNote Added: 0084897
2019-06-05 17:53Vico LiangRelationship addedrelated to 0030769
2019-06-13 12:03szyNote Added: 0085028
2019-06-13 12:03szyAssigned Toszy => bugmaster
2019-06-13 12:03szyStatusresolved => reviewed
2019-06-13 16:11bugmasterNote Added: 0085033
2019-06-13 16:12bugmasterAssigned Tobugmaster => mpv
2019-06-13 16:12bugmasterStatusreviewed => assigned
2019-06-13 19:49bugmasterNote Added: 0085042
2019-06-13 19:50bugmasterStatusassigned => resolved
2019-06-13 19:50bugmasterAssigned Tompv => bugmaster
2019-06-13 19:50bugmasterStatusresolved => reviewed
2019-06-13 19:51bugmasterStatusreviewed => tested
2019-06-13 19:51bugmasterTest case number => Not required
2019-06-15 16:04bugmasterChangeset attached => occt master 7f662bf4
2019-06-15 16:04bugmasterStatustested => verified
2019-06-15 16:04bugmasterResolutionopen => fixed
2019-06-16 11:39gitNote Added: 0085070

Notes
(0084770)
git   
2019-06-03 16:06   
Branch CR30761 has been created by mpv.

SHA-1: a89a076d90d7be0e67fda0977476562c57dcf5ea


Detailed log of new commits:

Author: mpv
Date: Mon Jun 3 16:05:25 2019 +0300

    30761: HOMEDRIVE and TEMP are undefined on UWP
    
    Avoid CDF_Stroe to find default folder since there is no case where this folder does not reset to exact value given by the user.
    Also, remove the exception raising for the case this method is called from outside.
(0084772)
Vico Liang   
2019-06-03 17:55   
(edited on: 2019-06-03 17:57)
Dear mpv,
I got your patch and build it for UWP. though the exception is gone away, it still can't save and load any ocaf document on UWP. There are error PCDM_RS_UnknownDocument when call
PCDM_ReaderStatus TDocStd_Application::Open (const TCollection_ExtendedString& path, Handle(TDocStd_Document)& aDoc).
The same code works on windows 10, but not working on uwp.

Could you please take a look at it? thanks.

(0084789)
Vico Liang   
2019-06-04 08:15   
There is no environment variables on UWP since it run in a sandbox. So occt should process all environment variables specially on uwp.
(0084802)
mpv   
2019-06-04 12:17   
Dear Vico,

OCCT already has a mechanism to open/save documents wihtout usage of resource files and special variables referencing to that files and drivers libraries:
https://www.opencascade.com/doc/occt-7.3.0/overview/html/occt_user_guides__ocaf.html#occt_ocaf_4_3_format [^]

You may just link (for an example, binary) drivers directly to your application by call:
BinDrivers::DefineFormat (app);

Where "app" is your TDocStd_Application instance. It may be done on creation of the application or just before save/open of the document.
(0084825)
Vico Liang   
2019-06-04 18:56   
Actually I do it without resource files. It doesn't work. I can't debug the code in vs2017, don't know why, otherwise more details can be provided.
(0084842)
mpv   
2019-06-05 09:47   
So, the original problem is fixed. SZY, please review the fix. No regressions are detected:
http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR30761-master-MPV-Products-Windows-64-VC14-opt-test-compare/1/ [^]
at http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR30761-master-MPV-Products-Debian80-64-opt-test-compare/1/ [^]
(0084897)
Vico Liang   
2019-06-05 17:53   
I have reported another bug 0030769 about the file open/save.
(0085028)
szy   
2019-06-13 12:03   
Reviewed.
(0085033)
bugmaster   
2019-06-13 16:11   
Fix has been tested on combination master/master
(0085042)
bugmaster   
2019-06-13 19:49   
Now all are right

Combination -
OCCT branch : CR30761
master SHA - a89a076d90d7be0e67fda0977476562c57dcf5ea
d67d4b811012eef8913d3c535c29654d0acf3c4c
Products branch : master SHA - 77ee1bd5095e6eb90974be94ecc6b503a187125a
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16288.120000000074 / 16197.160000000013 [+0.56%]
Products
Total CPU difference: 771.9299999999893 / 771.9399999999893 [-0.00%]
Windows-64-VC14:
OCCT
Total CPU difference: 17747.203125 / 17603.203125 [+0.82%]
Products
Total CPU difference: 12117.703125 / 12092.375 [+0.21%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0085070)
git   
2019-06-16 11:39   
Branch CR30761 has been deleted by inv.

SHA-1: a89a076d90d7be0e67fda0977476562c57dcf5ea