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
2021-09-22 16:41:01 +00:00
package diskstore ;import (_c "github.com/unidoc/unioffice/common/tempstorage";_f "io/ioutil";_a "os";_bb "strings";);
2020-12-17 22:07:08 +00:00
2021-08-23 20:44:48 +00:00
// Add is not applicable in the diskstore implementation
2021-09-22 16:41:01 +00:00
func (_d diskStorage )Add (path string )error {return nil };
2021-05-31 16:22:30 +00:00
2021-07-30 17:03:26 +00:00
// TempFile creates a new temp directory by calling ioutil TempDir
2021-09-22 16:41:01 +00:00
func (_e diskStorage )TempDir (pattern string )(string ,error ){return _f .TempDir ("",pattern )};
2021-06-16 07:10:52 +00:00
2021-08-23 20:44:48 +00:00
// SetAsStorage sets temp storage as a disk storage
2021-09-22 16:41:01 +00:00
func SetAsStorage (){_g :=diskStorage {};_c .SetAsStorage (&_g )};
// RemoveAll removes all files in the directory
func (_cc diskStorage )RemoveAll (dir string )error {if _bb .HasPrefix (dir ,_a .TempDir ()){return _a .RemoveAll (dir );};return nil ;};
2021-06-16 07:10:52 +00:00
2021-08-23 20:44:48 +00:00
// TempFile creates a new temp file by calling ioutil TempFile
2021-09-22 16:41:01 +00:00
func (_fa diskStorage )TempFile (dir ,pattern string )(_c .File ,error ){return _f .TempFile (dir ,pattern );};type diskStorage struct{};
2021-08-23 20:44:48 +00:00
// Open opens file from disk according to a path
2021-09-22 16:41:01 +00:00
func (_bg diskStorage )Open (path string )(_c .File ,error ){return _a .Open (path )};