File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
Graphics/GraphicsEngine/src Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2019-2022 Diligent Graphics LLC
2+ * Copyright 2019-2024 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
3434#include " ../../Primitives/interface/DataBlob.h"
3535#include " ObjectBase.hpp"
3636#include " FileWrapper.hpp"
37+ #include " RefCntAutoPtr.hpp"
3738
3839namespace Diligent
3940{
@@ -44,6 +45,8 @@ class BasicFileStream : public ObjectBase<IFileStream>
4445public:
4546 typedef ObjectBase<IFileStream> TBase;
4647
48+ static RefCntAutoPtr<BasicFileStream> Create (const Char* Path, EFileAccessMode Access = EFileAccessMode::Read);
49+
4750 BasicFileStream (IReferenceCounters* pRefCounters,
4851 const Char* Path,
4952 EFileAccessMode Access = EFileAccessMode::Read);
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2019-2022 Diligent Graphics LLC
2+ * Copyright 2019-2024 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
3131namespace Diligent
3232{
3333
34+ RefCntAutoPtr<BasicFileStream> BasicFileStream::Create (const Char* Path, EFileAccessMode Access)
35+ {
36+ if (Path == nullptr || Path[0 ] == ' \0 ' )
37+ {
38+ DEV_ERROR (" Path must not be null or empty" );
39+ return {};
40+ }
41+
42+ return RefCntAutoPtr<BasicFileStream>{MakeNewRCObj<BasicFileStream>()(Path, Access)};
43+ }
44+
3445BasicFileStream::BasicFileStream (IReferenceCounters* pRefCounters,
3546 const Char* Path,
3647 EFileAccessMode Access /* = EFileAccessMode::Read*/ ) :
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2019-2022 Diligent Graphics LLC
2+ * Copyright 2019-2024 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -83,7 +83,7 @@ void DefaultShaderSourceStreamFactory::CreateInputStream2(const Char*
8383 RefCntAutoPtr<BasicFileStream> pFileStream;
8484 if (FileSystem::FileExists (Path))
8585 {
86- pFileStream = MakeNewRCObj< BasicFileStream>() (Path, EFileAccessMode::Read);
86+ pFileStream = BasicFileStream::Create (Path, EFileAccessMode::Read);
8787 if (!pFileStream->IsValid ())
8888 pFileStream.Release ();
8989 }
You can’t perform that action at this time.
0 commit comments