Repository: opencv
Issue: Test Samples.findFile failes on Windows 10 x64 on some systems
Labels: bug,category: core,affected: 3.4,platform: win32

##### System information (version)
- OpenCV => 4.5.1-pre (git 46e275dfe4616b07cd2492c17698d1a0be0aa6df ), 3.4
- Operating System / Platform => Windows 10 x64
- Compiler => Visual Studio 2019 Community Editon x64, Ninja

##### Detailed description

The issue can be related to local settings somehow.
My test log:

```
[ RUN      ] Samples.findFile
[DEBUG:0] cv::samples::findFile('lena.jpg', false)
[DEBUG:0] utils::findDataFile('lena.jpg', OPENCV_SAMPLES_DATA_PATH)
[DEBUG:0] ... Line 175: trying open 'lena.jpg'
[VERB0:0] isSubDirectory(): base: C:/Slave/workspace/nightly-3.4/windows10/opencv-build  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build  => result: FALSE
[VERB0:0] isSubDirectory(): base: C:\Slave\workspace\nightly-3.4\windows10\opencv-build  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build  => result: FALSE
[DEBUG:0] Detected module path: 'c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\opencv_core3413.dll'
[VERB0:0] isSubDirectory(): base: C:/Slave/workspace/nightly-3.4/windows10/opencv-build  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\opencv_core3413.dll  => result: FALSE
[VERB0:0] isSubDirectory(): base: C:\Slave\workspace\nightly-3.4\windows10\opencv-build  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\opencv_core3413.dll  => result: FALSE
[DEBUG:0] utils::findDataFile(): trying install path (from binary path): c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\../../../etc
[DEBUG:0] utils::findDataFile(): ... skip, not a valid directory: c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\../../../etc
[VERB0:0] isSubDirectory(): base: C:/Slave/workspace/nightly-3.4/windows10/opencv-build/install  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\opencv_core3413.dll  => result: FALSE
[VERB0:0] isSubDirectory(): base: C:\Slave\workspace\nightly-3.4\windows10\opencv-build\install  path: c:\Slave\workspace\nightly-3.4\windows10\opencv-build\bin\opencv_core3413.dll  => result: FALSE
[ WARN:0] cv::samples::findFile('lena.jpg') => ''
C:\Slave\workspace\nightly-3.4\windows10\opencv\modules\core\test\test_utils.cpp(345): error: Expected: (std::string()) != (path.c_str()), actual: "" vs ""
[  FAILED  ] Samples.findFile (1 ms)
```

BuildBot CI log:

```
[ RUN      ] Samples.findFile
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\samples.cpp (52) cv::samples::findFile cv::samples::findFile('lena.jpg', false)
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (192) cv::utils::findDataFile utils::findDataFile('lena.jpg', OPENCV_SAMPLES_DATA_PATH)
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (207) cv::utils::findDataFile ... Line 207: trying open 'lena.jpg'
global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (102) cv::utils::isSubDirectory isSubDirectory(): base: C:/build/precommit_windows64/build  path: C:\build\precommit_windows64\build  => result: TRUE
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (283) cv::utils::findDataFile utils::findDataFile(): the current directory is build sub-directory: C:\build\precommit_windows64\build
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (287) cv::utils::findDataFile utils::findDataFile(): <build>/../opencv/
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (295) cv::utils::findDataFile ... Line 295: trying open 'C:/build/precommit_windows64/build\../opencv/lena.jpg'
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (295) cv::utils::findDataFile ... Line 295: trying open 'C:/build/precommit_windows64/build\../opencv/data\lena.jpg'
[DEBUG:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\datafile.cpp (295) cv::utils::findDataFile ... Line 295: trying open 'C:/build/precommit_windows64/build\../opencv/samples/data\lena.jpg'
[ WARN:0] global C:\build\precommit_windows64\opencv\modules\core\src\utils\samples.cpp (59) cv::samples::findFile cv::samples::findFile('lena.jpg') => 'C:/build/precommit_windows64/build\../opencv/samples/data\lena.jpg'
[       OK ] Samples.findFile (2 ms)
```

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with answers.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       answers.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://answers.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [ ] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->