Codeunit 1910 File Helper
src/System Application/App/Camera and Media Interaction/src/FileHelper.Codeunit.al49 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace System.Device;using System.Utilities;codeunit 1910 "File Helper"{ Access = Internal; InherentEntitlements = X; InherentPermissions = X; var FilePath: Text; FileNotAvailableErr: Label 'The file is not available.'; [TryFunction] procedure GetFile(var TempBlob: Codeunit "Temp Blob") var File: File; InStream: InStream; OutStream: OutStream; begin if not File.Open(FilePath) then Error(FileNotAvailableErr); File.CreateInStream(InStream); TempBlob.CreateOutStream(OutStream); CopyStream(OutStream, InStream); File.Close(); end; procedure FileExists(): Boolean begin if FilePath = '' then exit(false); exit(Exists(FilePath)); end; procedure SetPath(SavedFilePath: Text) begin FilePath := SavedFilePath; end;}