deploypcode(source_​dir, target_dir, varargin)

版本 1.10.0.0 (11.4 KB) 作者: Sven
DEPLOYPCODE recursively searches a directory for .m files, creating encrypted .p files with .m help
2.0K 次下载
更新时间 2015/1/8

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

This entry is ideal for those who have a project they need to deploy to P-files, but they want to retain HELP contents for all of their deployed files.
--
DEPLOYPCODE recursively creates p-code versions of m-files in a given folder
DEPLOYPCODE(SOURCE, TARGET) will recursively search the SOURCE folder for all .m files and
deploy them as P-files to the TARGET folder using default options below.

DEPLOYPCODE(..., 'PropertyName',VALUE,'PropertyName',VALUE,...) uses the following options
when deploying p-code:

'recurse' - When true (default) will recursively deploy p-code from SOURCE folder.

'ignoreStrings' - String or cell array of strings of filenames to ignore. Regular expression
syntax is used.

'ignoreSVN' - Additional true/false option to ignore ".svn" directories. Equivalent to
adding {'^\.svn$'} to "ignoreStrings". Defaults to TRUE for convenience.

'includeHelp' - MATLAB's pcode() removes all comments including the help section from
files when run. Setting this option to true (default) will export an
additional .m file containing only the help contents of the file being
deployed. This means that myFunction.m will be deployed to myFunction.p,
but calling "help myFunction" will still return help text.

'updateOnly' - When true, destination p-files will only be created if they don't yet
exist or are older than the m-file being encoded. Defaults to false.

'copyDirectStrings' - String or cell array of strings of filenames to copy directly to TARGET
folder without encryption. Regular expression syntax is used.

'copyFigFiles' - Additional true/false option to copy ".fig" files directly. Equivalent to
adding {'\.fig$'} to "copyDirectStrings". Defaults TRUE for convenience.
'copyDllFiles' - Additional true/false option to copy ".dll" files directly. Equivalent to
adding {'\.dll$'} to "copyDirectStrings". Defaults TRUE for convenience.
'copyMexFiles' - Additional true/false option to copy mex files directly. Defaults TRUE
for convenience.

'flattenFileTree' - When true (default), regular m-files are deployed as p-files only to the
TARGET folder initially provided (rather than under any subdirectories).
When this option is set to FALSE, the file structure under the SOURCE
directory will be replicated at the TARGET.

Example:
deploypcode('C:\sven\ASSEMBLA_sahm\matlab\sahm\','U:\SAHM\matlab\_includes\sahm','updateOnly',true)

written by Sven Holcombe Oct 2011

Author's note:
While I am generally against unnecessary encryption of .m files (it would be against the spirit of this file exchange, for one), I needed a tool such as this one for my work, and thought that others may need the same.

引用格式

Sven (2024). deploypcode(source_dir, target_dir, varargin) (https://www.mathworks.com/matlabcentral/fileexchange/26919-deploypcode-source_dir-target_dir-varargin), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

参考作品: genpath_exclude

启发作品: Deploy pcoded Matlab Files

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.10.0.0

Under-the-hood directory parsing function changed in 2014b causing an error. This update makes sure it runs without error on both old and new versions.

1.9.0.0

Minor change: used an onCleanup() object to return to the correct path. More error-safe.

1.7.0.0

Sorry - fixed some typos in the description

1.6.0.0

Missed an update from Andrea: wrapping the pcode() call in a try-catch to avoid dying on poorly formatted m-files.

1.5.0.0

Added two very useful addition to direct copy (.dll and mex), much thanks to Andrea Vaccaro for his suggestions!

1.4.0.0

Added 'copyDirectStrings' parameter to allow direct copy of chosen files as per DBSs request

1.3.0.0

Added a "flattenTreeFile = false" option, as requested by Greg

1.2.0.0

Added "updateOnly" functionality and improved the "p-file is older than m-file" issue generated when a class function file is p-coded.

1.1.0.0

Added .m help-file deployment, and rewrote to remove dependency on genpath_recurse thus improve speed.

1.0.0.0