Commit Graph

3 Commits

Author SHA1 Message Date
Xavier Deguillard
c6b9788af8 win: move win/utils onto utils/
Summary: This will make it easier to build with Buck.

Reviewed By: fanzeyi

Differential Revision: D23827754

fbshipit-source-id: bf3bf4d607a08b9831f9dfea172b2e923a219561
2020-09-22 09:09:56 -07:00
Xavier Deguillard
f4f159537f utils: add a platform independent FileUtils
Summary:
Up to now, Windows had to have its own version of folly::{readFile, writeFile,
writeFileAtomic} as these only operate on `char *` path, which can only
represent ascii paths on Windows. Since the Windows version is slightly
different from folly, this forced the code to either ifdef _WIN32, or use the
folly version pretending that it would be OK. The Windows version was also
behaving slightly differently from folly. For instance, where folly would
return a boolean to indicate success, on Windows we would throw an exception.

To simplify our code, add type safety and unify both, we can implement our own
wrappers on top of either folly or Windows APIs.

We still have some code that uses folly::readFile but these should only be
dealing with filedescriptors. As a following step, we may want to have our own
File class that wraps a file descriptor/HANDLE so we can completely remove all
uses of folly::readFile.

Reviewed By: wez

Differential Revision: D23037325

fbshipit-source-id: 2b9a026f3ee6220ef55097abe649b23e38d9fe91
2020-08-14 18:56:33 -07:00
Xavier Deguillard
6d4a55a3ea win: change the argument order for writeFile
Summary:
This brings it closer to folly::writeFile which should help in avoiding ifdef
whenever we want to use it.

Reviewed By: wez

Differential Revision: D21319020

fbshipit-source-id: 80fbf7fba671b18b5ef68375910e1a2a8869f590
2020-05-05 18:14:54 -07:00