Skip to content

Commit 0d73482

Browse files
author
kan
committed
- camel to snake
- unify field_name access to s.('field_name') -> s.field_name
1 parent 8d4f424 commit 0d73482

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

functions/package/package_app.m

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,40 @@ function package_app(confi)
3434

3535
% make a default selection of the parts of the application to package
3636
%
37-
current_dir = pwd();
38-
slashes_pos = regexp(current_dir,filesep() );
39-
projectFolder = current_dir(slashes_pos(end)+1:end);
40-
folderPath = current_dir(1:slashes_pos(end)-1);
41-
fullProjectPath = current_dir;
37+
current_dir = pwd();
38+
slashes_pos = regexp(current_dir,filesep() );
39+
project_folder = current_dir(slashes_pos(end)+1:end);
40+
folder_path = current_dir(1:slashes_pos(end)-1);
41+
full_project_path = current_dir;
4242

43-
confi.('projectFolder') = projectFolder ;
44-
confi.('fullProjectPath') = fullProjectPath ;
43+
confi.project_folder = project_folder ;
44+
confi.full_project_path = full_project_path ;
4545

4646
% ask for the default file and folder name?
4747
% default rojectname + timestamp for now
4848
if isempty(fn_confi)
49-
confi.('fileName') = [projectFolder, '_', datestr(now(), 'yyyymmddHHMMSS')];
49+
confi.file_name = [project_folder, '_', datestr(now(), 'yyyymmddHHMMSS')];
5050
end
5151

5252
if isempty(fn_confi)
53-
confi.('folderPath') = folderPath ;
53+
confi.folder_path = folder_path ;
5454
end
5555

5656
% parts to package - run MATLABs dependency analysis
5757
if isempty(fn_confi)
5858

5959
fList = matlab.codetools.requiredFilesAndProducts(...
60-
fullfile(confi.('fullProjectPath'), 'host', 'mfiles', 'host_app.m'));
60+
fullfile(confi.full_project_path, 'host', 'mfiles', 'host_app.m'));
6161
fList = fList(:);
6262
confi.('fList') = fList;
6363
end
6464

6565
%% add contents of the static/icons .. folder
6666
fn_static = {'icons', 'audio', 'img', 'misc'};
6767

68-
for j = 1:numel(fn_static)
68+
for j = 1 : numel(fn_static)
6969

70-
m = dir(fullfile(confi.('fullProjectPath'), 'static', fn_static{j}));
70+
m = dir(fullfile(confi.full_project_path, 'static', fn_static{j}));
7171
isfile = ~cell2mat({m.isdir}');
7272

7373
m = m(isfile);
@@ -86,33 +86,34 @@ function package_app_export_part(confi)
8686
%% apply the previously obtained export configuration
8787

8888
% create a project directory
89-
targetDir = fullfile(confi.('folderPath'), confi.('fileName'));
90-
confi.('targetDir') = targetDir ;
89+
target_dir = fullfile(confi.folder_path, confi.file_name);
90+
confi.target_dir = target_dir ;
9191

92-
if exist( confi.('targetDir'), 'dir') ~= 7
93-
mkdir(confi.('targetDir'));
92+
if exist(confi.target_dir, 'dir') ~= 7
93+
mkdir(confi.target_dir);
9494
end
9595

9696

97-
for i = 1: numel(confi.('fList'))
97+
for i = 1 : numel(confi.('fList'))
9898
% copies files into one single directory
9999
% .. todo:: write a filename check to prevent overwriting existing files
100100
%
101101
slashpos = regexp(confi.('fList'){i}, filesep());
102102
fName = confi.('fList'){i}(slashpos(end)+1 : end);
103-
target_loc = fullfile (confi.('targetDir'), fName);
103+
target_loc = fullfile(confi.target_dir, fName);
104104
copyfile(confi.('fList'){i}, target_loc)
105105
end
106106

107-
target_dir = dir(confi.('targetDir'));
108-
target_names = {target_dir.name};
109-
target_isdir = [target_dir.isdir];
110-
target_names = target_names(~target_isdir );
107+
target_dir_content = dir(confi.target_dir);
108+
target_names = {target_dir_content.name};
109+
target_isdir = [target_dir_content.isdir];
110+
target_names = target_names(~target_isdir);
111111

112112
% zip(zipfilename, filenames, rootfolder)
113-
zip(fullfile(confi.('targetDir'), [confi.fileName, '.zip']),...
113+
zip(...
114+
fullfile(confi.target_dir, [confi.file_name, '.zip']),...
114115
target_names,...
115-
confi.('targetDir'))
116+
confi.target_dir)
116117
fprintf('The project was packaged at:\n %s\n', target_dir)
117118

118119
end

0 commit comments

Comments
 (0)