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
|
2022-06-27 19:44:23 +00:00
|
|
|
package diskstore ;import (_a "github.com/unidoc/unioffice/common/tempstorage";_g "io/ioutil";_f "os";_c "strings";);
|
|
|
|
|
|
|
|
// Open opens file from disk according to a path
|
|
|
|
func (_bg diskStorage )Open (path string )(_a .File ,error ){return _f .OpenFile (path ,_f .O_RDWR ,0644)};
|
|
|
|
|
|
|
|
// SetAsStorage sets temp storage as a disk storage
|
|
|
|
func SetAsStorage (){_ac :=diskStorage {};_a .SetAsStorage (&_ac )};type diskStorage struct{};
|
2022-02-25 19:20:45 +00:00
|
|
|
|
2022-04-09 14:27:46 +00:00
|
|
|
// TempFile creates a new temp file by calling ioutil TempFile
|
2022-06-27 19:44:23 +00:00
|
|
|
func (_fc diskStorage )TempFile (dir ,pattern string )(_a .File ,error ){return _g .TempFile (dir ,pattern );};
|
2021-08-23 20:44:48 +00:00
|
|
|
|
2022-02-25 19:20:45 +00:00
|
|
|
// TempFile creates a new temp directory by calling ioutil TempDir
|
2022-06-27 19:44:23 +00:00
|
|
|
func (_e diskStorage )TempDir (pattern string )(string ,error ){return _g .TempDir ("",pattern )};
|
2021-11-10 11:45:21 +00:00
|
|
|
|
2022-04-09 14:27:46 +00:00
|
|
|
// Add is not applicable in the diskstore implementation
|
2022-06-27 19:44:23 +00:00
|
|
|
func (_ad diskStorage )Add (path string )error {return nil };
|
2022-01-15 21:17:38 +00:00
|
|
|
|
2022-04-09 14:27:46 +00:00
|
|
|
// RemoveAll removes all files in the directory
|
2022-06-27 19:44:23 +00:00
|
|
|
func (_fb diskStorage )RemoveAll (dir string )error {if _c .HasPrefix (dir ,_f .TempDir ()){return _f .RemoveAll (dir );};return nil ;};
|