time | calls | line |
---|
| | 199 | function fn = getFileToRun(inPath_arg)
|
| | 200 | % Return a string containing the absolute path of the file that
|
| | 201 | % MATLAB will run based on the input filename (e.g., foo)
|
| | 202 |
|
| | 203 | import com.mathworks.jmi.MatlabPath;
|
| | 204 |
|
0.01 | 1 | 205 | if isFileInPackage(inPath_arg) || isObject(inPath_arg)
|
| | 206 | % 1) For MCOS files, we need to determine whether the parent
|
| | 207 | % directory for the package or class is on the path. If the
|
| | 208 | % parent directory is not on the path, then return the empty
|
| | 209 | % string.
|
| | 210 | parentPath = MatlabPath.getValidPathEntryParent(java.io.File(inPath_arg).getParentFile());
|
| | 211 | if ~isDirectoryOnPath(char(parentPath.getPath))
|
| | 212 | fn = '';
|
| | 213 | return;
|
| | 214 | end
|
| | 215 |
|
| | 216 | % 2) Next, determine what which thinks is the full path to the
|
| | 217 | % class or method that we're trying to set a breakpoint in.
|
| | 218 | % Then, look to see if the result of which is on the path (it
|
| | 219 | % might not be if we're inside the class or package directory).
|
| | 220 | whichResult = which(trimToMcosPath(inPath_arg));
|
| | 221 | whichParentPath = MatlabPath.getValidPathEntryParent(java.io.File(whichResult).getParentFile());
|
| | 222 | if isDirectoryOnPath(char(whichParentPath.getPath))
|
| | 223 | fn = whichResult;
|
| | 224 | return;
|
| | 225 | end
|
| | 226 |
|
| | 227 | % 3) Finally, if the given file is on the path, and not found by
|
| | 228 | % which, simply return the given file.
|
| | 229 | fn = inPath_arg;
|
| 1 | 230 | elseif isPrivate(inPath_arg)
|
| | 231 | % For files in a private use absolute path
|
| | 232 | fn = which(inPath_arg);
|
| 1 | 233 | else % make the variable names somewhat obscure -- geck 281208
|
| 1 | 234 | [~, fileparts_Filename_Var] = fileparts(inPath_arg);
|
| 1 | 235 | fn = which(fileparts_Filename_Var);
|
| | 236 | % correct returned built-ins to point to their matching file for the purposes of command-line help -- geck 376452
|
| 1 | 237 | if ( 1 ==strfind( fn, 'built-in (' ) )
|
| | 238 | fn = fn(length('built-in (')+1:length(fn)-1); % e.g. matlabroot '/toolbox/matlab/ops/@single/plus'
|
| | 239 | fn = [fn '.m'];
|
| | 240 | end
|
| 1 | 241 | end
|
| 1 | 242 | end
|
Other subfunctions in this file are not included in this listing.