32 lines
1.5 KiB
Go
Raw Normal View History

2020-08-23 14:15:53 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
// Package diskstore implements tempStorage interface
// by using disk as a storage
2023-07-04 11:04:03 +00:00
package diskstore ;import (_ba "github.com/unidoc/unioffice/common/tempstorage";_e "io/ioutil";_eb "os";_bc "strings";);type diskStorage struct{};
// TempFile creates a new temp file by calling ioutil TempFile
func (_d diskStorage )TempFile (dir ,pattern string )(_ba .File ,error ){return _e .TempFile (dir ,pattern );};
2021-11-10 11:45:21 +00:00
2023-06-10 07:12:37 +00:00
// Open opens file from disk according to a path
2023-07-04 11:04:03 +00:00
func (_f diskStorage )Open (path string )(_ba .File ,error ){return _eb .OpenFile (path ,_eb .O_RDWR ,0644);};
2022-01-15 21:17:38 +00:00
2023-04-15 17:27:31 +00:00
// TempFile creates a new temp directory by calling ioutil TempDir
2023-07-04 11:04:03 +00:00
func (_ga diskStorage )TempDir (pattern string )(string ,error ){return _e .TempDir ("",pattern )};
2023-05-26 09:49:04 +00:00
2023-07-04 11:04:03 +00:00
// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_g :=diskStorage {};_ba .SetAsStorage (&_g )};
2022-09-02 11:46:53 +00:00
2023-07-04 11:04:03 +00:00
// Add is not applicable in the diskstore implementation
func (_ge diskStorage )Add (path string )error {return nil };
2022-09-02 11:46:53 +00:00
2023-05-26 09:49:04 +00:00
// RemoveAll removes all files in the directory
2023-07-04 11:04:03 +00:00
func (_bf diskStorage )RemoveAll (dir string )error {if _bc .HasPrefix (dir ,_eb .TempDir ()){return _eb .RemoveAll (dir );};return nil ;};