121 if ~isempty(this.fDataDir) && ~this.isSaved && exist(this.fDataDir,
" dir ") == 7
122 if length(dir(this.fDataDir)) ~= 2
123 warning(
" KerMor:FileData ",...
124 " A FileData instance (%s) should be deleted but the DataDirectory '%s' is not empty. Not deleting. ",...
125 class(
this),this.fDataDir);
127 rmdir(this.fDataDir);
135 #if 0 //mtoc++: 'set.DataDirectory'
138 if
Utils.ensureDir(value);
139 this.fDataDir= value;
142 warning("
KerMor:
FileData "," Could not make sure that the directory '%s' exists.\nPlease ensure a correct path and try again. ",value);
152 #if 0 //mtoc++: 'get.DataDirectory'
163 file = fullfile(this.fDataDir,file);
164 if exist(file,
" file ") ~= 2
166 error(
" File '%s' not found in folder '%s'. Have you deleted data files? ",...
169 error([
" File '%s' not found. This FileData instance was created on host '%s' "...
170 " and the DataDirectory cannot be found on the local machine '%s'.\n "...
171 " Copy the files to an accessible directory and use the 'relocate' method. "],...
192 static function this =
loadobj(
this,initfrom) {
195 if ~isa(
this,
" data.FileData ")
197 if isfield(initfrom,
" fDataDir ")
198 this = data.FileData(initfrom.fDataDir);
200 this = data.FileData(initfrom.DataDirectory);
206 if isfield(initfrom,
" fDataDir ")
207 this.fDataDir= initfrom.fDataDir;
209 this.fDataDir= initfrom.DataDirectory;
212 this.
Host= initfrom.Host;
213 this.
isSaved= initfrom.isSaved;
215 if ~isempty(this.fDataDir) && exist(this.fDataDir,
" file ") == 0
216 str =
" Directory '%s' not found. Loading files will not work until fixed.\n ";
218 str = sprintf([
" %sNote that this FileData has been created on machine %s. "...
219 " If you changed the computer (local: %s), use the 'relocate' method.\n "],str,this.Host,
KerMor.
getHost);
221 fprintf(2,str,this.fDataDir);
static function host = getHost()
Returns the hostname of the current machine.
Collection of generally useful functions.
function file = getfile(file)
function this = saveobj()
Set saved flag so that the data files do not get deleted on the delete method.
Matlab's base handle class (documentation generation substitute)
function relocate(char new_root)
Relocates this FileData instance to a different folder.
FileData: Base class for access of files stored in a specific folder in the local file system...
char DataDirectory
The root folder where the FileData's files are saved.
char Host
The host machine this file data is created on.
logical isSaved
This flag indicates that this FileData instance has been stored to disk via the save method somewhere...
Global configuration class for all KerMor run-time settings.
A MatLab character array.
static function this = loadobj(this, initfrom)
Loads a FileData instance.