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
|
2021-01-04 16:11:39 +00:00
|
|
|
package diskstore ;import (_bd "github.com/unidoc/unioffice/common/tempstorage";_e "io/ioutil";_bb "os";_b "strings";);type diskStorage struct{};
|
2020-08-23 14:15:53 +00:00
|
|
|
|
2020-12-17 22:07:08 +00:00
|
|
|
// Open opens file from disk according to a path
|
2021-01-04 16:11:39 +00:00
|
|
|
func (_cd diskStorage )Open (path string )(_bd .File ,error ){return _bb .Open (path )};
|
2020-12-17 22:07:08 +00:00
|
|
|
|
2021-01-04 16:11:39 +00:00
|
|
|
// TempFile creates a new temp directory by calling ioutil TempDir
|
|
|
|
func (_g diskStorage )TempDir (pattern string )(string ,error ){return _e .TempDir ("",pattern )};
|
2020-11-09 01:00:18 +00:00
|
|
|
|
2020-12-17 22:07:08 +00:00
|
|
|
// TempFile creates a new temp file by calling ioutil TempFile
|
2021-01-04 16:11:39 +00:00
|
|
|
func (_a diskStorage )TempFile (dir ,pattern string )(_bd .File ,error ){return _e .TempFile (dir ,pattern );};
|
|
|
|
|
|
|
|
// RemoveAll removes all files in the directory
|
|
|
|
func (_gf diskStorage )RemoveAll (dir string )error {if _b .HasPrefix (dir ,_bb .TempDir ()){return _bb .RemoveAll (dir );};return nil ;};
|
2020-11-09 01:00:18 +00:00
|
|
|
|
|
|
|
// Add is not applicable in the diskstore implementation
|
2021-01-04 16:11:39 +00:00
|
|
|
func (_bbc diskStorage )Add (path string )error {return nil };
|
2020-10-12 13:59:12 +00:00
|
|
|
|
2021-01-04 16:11:39 +00:00
|
|
|
// SetAsStorage sets temp storage as a disk storage
|
|
|
|
func SetAsStorage (){_bde :=diskStorage {};_bd .SetAsStorage (&_bde )};
|