333 lines
26 KiB
HTML
333 lines
26 KiB
HTML
|
<!doctype html><html lang='en'><head><title>PathName | SuperCollider 3.9.3 Help</title>
|
||
|
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
|
||
|
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
|
||
|
<link rel='stylesheet' href='./../custom.css' type='text/css' />
|
||
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
|
||
|
<script>
|
||
|
var helpRoot = './..';
|
||
|
var scdoc_title = 'PathName';
|
||
|
var scdoc_sc_version = '3.9.3';
|
||
|
</script>
|
||
|
<script src='./../scdoc.js' type='text/javascript'></script>
|
||
|
<script src='./../docmap.js' type='text/javascript'></script>
|
||
|
<script src='./../prettify.js' type='text/javascript'></script>
|
||
|
<script src='./../lang-sc.js' type='text/javascript'></script>
|
||
|
</head>
|
||
|
<body onload='fixTOC();prettyPrint()'>
|
||
|
<div id='toc'>
|
||
|
<div id='toctitle'>PathName:</div>
|
||
|
<span class='toc_search'>Filter: <input id='toc_search'></span><ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
|
||
|
<ul class='toc'></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
|
||
|
<ul class='toc'><li class='toc3'><a href='#*new'>new</a> </li>
|
||
|
<li class='toc3'><a href='#*tmp'>tmp</a> </li>
|
||
|
<li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
|
||
|
<li class='toc2'><a href='#Undocumented%20class%20methods'>Undocumented class methods</a></li>
|
||
|
<ul class='toc'><li class='toc3'><a href='#*abrevDocumentPath'>abrevDocumentPath</a> </li>
|
||
|
<li class='toc3'><a href='#*documentDir'>documentDir</a> </li>
|
||
|
<li class='toc3'><a href='#*fromOS9'>fromOS9</a> </li>
|
||
|
<li class='toc3'><a href='#*scroot'>scroot</a> </li>
|
||
|
<li class='toc3'><a href='#*standardizeDocumentPath'>standardizeDocumentPath</a> </li>
|
||
|
</ul></ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
|
||
|
<ul class='toc'><li class='toc3'><a href='#-fileName'>fileName</a> </li>
|
||
|
<li class='toc3'><a href='#-fileNameWithoutExtension'>fileNameWithoutExtension</a> </li>
|
||
|
<li class='toc3'><a href='#-extension'>extension</a> </li>
|
||
|
<li class='toc3'><a href='#-pathOnly'>pathOnly</a> </li>
|
||
|
<li class='toc3'><a href='#-isAbsolutePath'>isAbsolutePath</a> <a href='#-asAbsolutePath'>asAbsolutePath</a> <a href='#-isRelativePath'>isRelativePath</a> <a href='#-asRelativePath'>asRelativePath</a> </li>
|
||
|
<li class='toc3'><a href='#-folderName'>folderName</a> </li>
|
||
|
<li class='toc3'><a href='#-fullPath'>fullPath</a> </li>
|
||
|
<li class='toc3'><a href='#-entries'>entries</a> </li>
|
||
|
<li class='toc3'><a href='#-files'>files</a> </li>
|
||
|
<li class='toc3'><a href='#-folders'>folders</a> </li>
|
||
|
<li class='toc3'><a href='#-isFile'>isFile</a> </li>
|
||
|
<li class='toc3'><a href='#-isFolder'>isFolder</a> </li>
|
||
|
<li class='toc3'><a href='#-filesDo'>filesDo</a> </li>
|
||
|
<li class='toc3'><a href='#-allFolders'>allFolders</a> </li>
|
||
|
<li class='toc3'><a href='#-diskName'>diskName</a> </li>
|
||
|
<li class='toc3'><a href='#-+/+'>+/+</a> </li>
|
||
|
<li class='toc3'><a href='#-endNumber'>endNumber</a> </li>
|
||
|
<li class='toc3'><a href='#-noEndNumbers'>noEndNumbers</a> </li>
|
||
|
<li class='toc3'><a href='#-nextName'>nextName</a> </li>
|
||
|
<li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
|
||
|
<li class='toc2'><a href='#Undocumented%20instance%20methods'>Undocumented instance methods</a></li>
|
||
|
<ul class='toc'><li class='toc3'><a href='#-absolutePath'>absolutePath</a> </li>
|
||
|
<li class='toc3'><a href='#-colonIndices'>colonIndices</a> </li>
|
||
|
<li class='toc3'><a href='#-deepFiles'>deepFiles</a> </li>
|
||
|
<li class='toc3'><a href='#-dumpToDoc'>dumpToDoc</a> </li>
|
||
|
<li class='toc3'><a href='#-dumpTree'>dumpTree</a> </li>
|
||
|
<li class='toc3'><a href='#-endNumberIndex'>endNumberIndex</a> </li>
|
||
|
<li class='toc3'><a href='#-fileNameWithoutDoubleExtension'>fileNameWithoutDoubleExtension</a> </li>
|
||
|
<li class='toc3'><a href='#-filesDoNoCVS'>filesDoNoCVS</a> </li>
|
||
|
<li class='toc3'><a href='#-filesDoNoSVN'>filesDoNoSVN</a> </li>
|
||
|
<li class='toc3'><a href='#-foldersWithoutCVS'>foldersWithoutCVS</a> </li>
|
||
|
<li class='toc3'><a href='#-foldersWithoutSVN'>foldersWithoutSVN</a> </li>
|
||
|
<li class='toc3'><a href='#-helpFilesDo'>helpFilesDo</a> </li>
|
||
|
<li class='toc3'><a href='#-isCVS'>isCVS</a> </li>
|
||
|
<li class='toc3'><a href='#-isSVN'>isSVN</a> </li>
|
||
|
<li class='toc3'><a href='#-lastColonIndex'>lastColonIndex</a> </li>
|
||
|
<li class='toc3'><a href='#-parentPath'>parentPath</a> </li>
|
||
|
<li class='toc3'><a href='#-pathMatch'>pathMatch</a> </li>
|
||
|
<li class='toc3'><a href='#-streamTree'>streamTree</a> </li>
|
||
|
<li class='toc3'><a href='#-streamTreeNoCVS'>streamTreeNoCVS</a> </li>
|
||
|
</ul></ul><li class='toc1'><a href='#examples'>Examples</a></li>
|
||
|
<ul class='toc'></ul></ul></div><div class='contents'>
|
||
|
<div id='menubar'></div>
|
||
|
<div class='header'>
|
||
|
<div id='label'>
|
||
|
<span id='folder'>Classes</span>
|
||
|
| <span id='categories'><a href='./../Browse.html#Files'>Files</a></span>
|
||
|
</div><h1>PathName<span id='superclasses'> : <a href="../Classes/Object.html">Object</a></span>
|
||
|
</h1>
|
||
|
<div id='summary'>file and directory path utilities</div>
|
||
|
</div>
|
||
|
<div class='subheader'>
|
||
|
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Files/PathName.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Files/PathName.sc'>PathName.sc</a></div><div id='related'>See also: <a href="./../Classes/File.html">File</a>, <a href="./../Classes/String.html">String</a></div>
|
||
|
</div>
|
||
|
<h2><a class='anchor' name='description'>Description</a></h2>
|
||
|
|
||
|
<p>PathName is a utility class for manipulating file names and paths. It expects a path to a file, and lets you access parts of that file path.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*new' href='./../Overviews/Methods.html#new'>new</a>(<span class='argstr'>path: ""</span>)</h3>
|
||
|
<div class='method'>
|
||
|
<p><h4>Arguments:</h4>
|
||
|
<table class='arguments'>
|
||
|
<tr><td class='argumentname'>path<td class='argumentdesc'>
|
||
|
<p>a <a href="./../Classes/String.html">String</a> which likely contains one or more / as typical for folder separation. ~ will be converted to your fully addressed home directory, as per <a href="./../Classes/String.html#-standardizePath">String: -standardizePath</a>.<pre class='code prettyprint lang-sc'>PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");</pre>
|
||
|
</table></div><h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*tmp' href='./../Overviews/Methods.html#tmp'>tmp</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*tmp' href='./../Overviews/Methods.html#tmp'>tmp</a> = value</h3>
|
||
|
<div class='method'>
|
||
|
<p>Get or set the global temp directory as a <a href="./../Classes/String.html">String</a>. This is used by <a href="./../Classes/Buffer.html">Buffer</a>, etc. By default this is "/tmp/" for Linux and macOS, and "/WINDOWS/TEMP/" for Windows.</div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
|
||
|
<div id='inheritedclassmets'></div><h3><a class='anchor' name='Undocumented%20class%20methods'>Undocumented class methods</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*abrevDocumentPath' href='./../Overviews/Methods.html#abrevDocumentPath'>abrevDocumentPath</a>(<span class='argstr'>path</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc'>/Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*documentDir' href='./../Overviews/Methods.html#documentDir'>documentDir</a></h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc'>/Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*fromOS9' href='./../Overviews/Methods.html#fromOS9'>fromOS9</a>(<span class='argstr'>path</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*scroot' href='./../Overviews/Methods.html#scroot'>scroot</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*scroot' href='./../Overviews/Methods.html#scroot'>scroot</a> = value</h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>PathName.</span><a class='method-name' name='*standardizeDocumentPath' href='./../Overviews/Methods.html#standardizeDocumentPath'>standardizeDocumentPath</a>(<span class='argstr'>p</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc'>/Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/Players/pathUtilities.sc</a></div>
|
||
|
<h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-fileName' href='./../Overviews/Methods.html#fileName'>fileName</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns just the name of the file itself; i.e. everything after the last slash in the full path.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.fileName.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-fileNameWithoutExtension' href='./../Overviews/Methods.html#fileNameWithoutExtension'>fileNameWithoutExtension</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns the name of the file itself without the file extension.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-extension' href='./../Overviews/Methods.html#extension'>extension</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns the file extension, i.e. everything after the last full-stop in the <a href="#-fileName">-fileName</a>.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-pathOnly' href='./../Overviews/Methods.html#pathOnly'>pathOnly</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns the full path up to the file name itself; i.e. everything up to and including the last slash. This is handy e.g. for storing several files in the same folder.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.pathOnly.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isAbsolutePath' href='./../Overviews/Methods.html#isAbsolutePath'>isAbsolutePath</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-asAbsolutePath' href='./../Overviews/Methods.html#asAbsolutePath'>asAbsolutePath</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isRelativePath' href='./../Overviews/Methods.html#isRelativePath'>isRelativePath</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-asRelativePath' href='./../Overviews/Methods.html#asRelativePath'>asRelativePath</a>(<span class='argstr'>relativeTo</span>)</h3>
|
||
|
<div class='method'>
|
||
|
<p>you MUST have correctly initialized the scroot classvar for this to know what it is relative to !</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-folderName' href='./../Overviews/Methods.html#folderName'>folderName</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns only the name of the folder that the file is in; i.e. everything in between the last but one and the last slash.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.folderName.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-fullPath' href='./../Overviews/Methods.html#fullPath'>fullPath</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns the full path name that PathName contains.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.fullPath.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-entries' href='./../Overviews/Methods.html#entries'>entries</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a list of all the files+folders inside the folder represented by this path.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.entries.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-files' href='./../Overviews/Methods.html#files'>files</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a list of all the files in the folder represented by this path.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.files.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-folders' href='./../Overviews/Methods.html#folders'>folders</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a list of all the subfolders of the folder represented by this path.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.folders.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isFile' href='./../Overviews/Methods.html#isFile'>isFile</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a <a href="./../Classes/Boolean.html">Boolean</a> indicating whether or not the path represents a file (not a folder).<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.isFile.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isFolder' href='./../Overviews/Methods.html#isFolder'>isFolder</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a <a href="./../Classes/Boolean.html">Boolean</a> indicating whether or not the path represents a folder (not a file).<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.isFolder.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-filesDo' href='./../Overviews/Methods.html#filesDo'>filesDo</a>(<span class='argstr'>func</span>)</h3>
|
||
|
<div class='method'>
|
||
|
<p>Iterates over all files found in the pathname, including ones in subfolders.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("./");
|
||
|
myPath.filesDo{|afile| afile.postln};
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-allFolders' href='./../Overviews/Methods.html#allFolders'>allFolders</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a list of all the folder names contained in the pathname itself.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.allFolders.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-diskName' href='./../Overviews/Methods.html#diskName'>diskName</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>if path is an absolute path, returns the disk name; else a blank string.<pre class='code prettyprint lang-sc'>(
|
||
|
var myPath;
|
||
|
myPath = PathName.new("MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.diskName.postln;
|
||
|
)
|
||
|
|
||
|
( // note the / at the start
|
||
|
var myPath;
|
||
|
myPath = PathName.new("/MyDisk/SC 2.2.8 f/Sounds/FunkyChicken");
|
||
|
myPath.diskName.postln;
|
||
|
)</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'></span><a class='method-name' name='-+/+' href='./../Overviews/Methods.html#+/+'>+/+</a>(<span class='argstr'>path</span>)</h3>
|
||
|
<div class='method'>
|
||
|
<p>Path concatenation operator - useful for avoiding doubling-up slashes unnecessarily.<pre class='code prettyprint lang-sc'>(PathName("/somewhere") +/+ PathName("over/the/rainbow")).postln;
|
||
|
(PathName("/somewhere") +/+ PathName("/over/the/rainbow")).postln;</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-endNumber' href='./../Overviews/Methods.html#endNumber'>endNumber</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns a number at the end of PathName. Returns zero if there is no number.<pre class='code prettyprint lang-sc'>PathName("floating1").endNumber.postln;
|
||
|
PathName("floating").endNumber.postln;</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-noEndNumbers' href='./../Overviews/Methods.html#noEndNumbers'>noEndNumbers</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>returns <a href="#-fullPath">-fullPath</a> without any numbers at the end.<pre class='code prettyprint lang-sc'>PathName("floating1").noEndNumbers.postln;
|
||
|
PathName("floating").noEndNumbers.postln;</pre>
|
||
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-nextName' href='./../Overviews/Methods.html#nextName'>nextName</a></h3>
|
||
|
<div class='method'>
|
||
|
<p>generates a sensible next name for a file by incrementing a number at the end of PathName, or by adding one if there is none. This is useful for recording files with consecutive names, and e.g. to generate a new filename when you don't want to overwrite an existing file with the current name.<pre class='code prettyprint lang-sc'>PathName("floating34").nextName.postln;
|
||
|
PathName("floating").nextName.postln;
|
||
|
PathName("floating12_3A4X_56.7").nextName.postln;</pre>
|
||
|
</div><h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
|
||
|
<div id='inheritedinstmets'></div><h3><a class='anchor' name='Undocumented%20instance%20methods'>Undocumented instance methods</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-absolutePath' href='./../Overviews/Methods.html#absolutePath'>absolutePath</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-colonIndices' href='./../Overviews/Methods.html#colonIndices'>colonIndices</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-deepFiles' href='./../Overviews/Methods.html#deepFiles'>deepFiles</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-dumpToDoc' href='./../Overviews/Methods.html#dumpToDoc'>dumpToDoc</a>(<span class='argstr'>title: "Untitled"</span>)</h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-dumpTree' href='./../Overviews/Methods.html#dumpTree'>dumpTree</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-endNumberIndex' href='./../Overviews/Methods.html#endNumberIndex'>endNumberIndex</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-fileNameWithoutDoubleExtension' href='./../Overviews/Methods.html#fileNameWithoutDoubleExtension'>fileNameWithoutDoubleExtension</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-filesDoNoCVS' href='./../Overviews/Methods.html#filesDoNoCVS'>filesDoNoCVS</a>(<span class='argstr'>func</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-filesDoNoSVN' href='./../Overviews/Methods.html#filesDoNoSVN'>filesDoNoSVN</a>(<span class='argstr'>func</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-foldersWithoutCVS' href='./../Overviews/Methods.html#foldersWithoutCVS'>foldersWithoutCVS</a>(<span class='argstr'>path</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-foldersWithoutSVN' href='./../Overviews/Methods.html#foldersWithoutSVN'>foldersWithoutSVN</a>(<span class='argstr'>path</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-helpFilesDo' href='./../Overviews/Methods.html#helpFilesDo'>helpFilesDo</a>(<span class='argstr'>func</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isCVS' href='./../Overviews/Methods.html#isCVS'>isCVS</a></h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-isSVN' href='./../Overviews/Methods.html#isSVN'>isSVN</a></h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-lastColonIndex' href='./../Overviews/Methods.html#lastColonIndex'>lastColonIndex</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-parentPath' href='./../Overviews/Methods.html#parentPath'>parentPath</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-pathMatch' href='./../Overviews/Methods.html#pathMatch'>pathMatch</a></h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-streamTree' href='./../Overviews/Methods.html#streamTree'>streamTree</a>(<span class='argstr'>str</span>, <span class='argstr'>tabs: 0</span>)</h3>
|
||
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-streamTreeNoCVS' href='./../Overviews/Methods.html#streamTreeNoCVS'>streamTreeNoCVS</a>(<span class='argstr'>str</span>, <span class='argstr'>tabs: 0</span>)</h3>
|
||
|
<div class='extmethod'>From extension in <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.9/deprecated-3.9.sc</a></div>
|
||
|
<h2><a class='anchor' name='examples'>Examples</a></h2>
|
||
|
|
||
|
<p>Here is an example that uses many instance methods. Just pick any file to see all the parts of its path.<pre class='code prettyprint lang-sc'>(
|
||
|
GetFileDialog.new(
|
||
|
{ arg ok, path;
|
||
|
var myPathName;
|
||
|
if (ok,
|
||
|
{
|
||
|
myPathName = PathName.new(path);
|
||
|
|
||
|
"New PathName object: ".postc;
|
||
|
myPathName.postln;
|
||
|
|
||
|
"fileName only: ".postc;
|
||
|
myPathName.fileName.postln;
|
||
|
|
||
|
"path up to file only: ".postc;
|
||
|
myPathName.pathOnly.postln;
|
||
|
|
||
|
"folder Name: ".postc;
|
||
|
myPathName.folderName.postln;
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
)
|
||
|
)</pre>
|
||
|
|
||
|
<p>Choose a soundfile to put into the library, using its foldername and filename.<pre class='code prettyprint lang-sc'>(
|
||
|
GetFileDialog.new(
|
||
|
{ arg ok, path;
|
||
|
var myPathName, myFile;
|
||
|
if (ok,
|
||
|
{
|
||
|
myPathName = PathName.new(path);
|
||
|
|
||
|
// read your file from disk, e.g. a soundFile/
|
||
|
|
||
|
myFile = SoundFile.new;
|
||
|
if (myFile.openRead(path),
|
||
|
{
|
||
|
Library.put(
|
||
|
[ myPathName.folderName.asSymbol, myPathName.fileName.asSymbol ],
|
||
|
myFile);
|
||
|
("Check Library.global" + myPathName.folderName + "please.").postln;
|
||
|
},
|
||
|
{ ("Could not read soundfile" + path ++ ".").postln; }
|
||
|
);
|
||
|
myFile.close;
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
)
|
||
|
)</pre>
|
||
|
|
||
|
<p>Save three tables in the same folder. Note: The file name chosen in the dialog is ignored! The files are always named table1, table2, table3.<pre class='code prettyprint lang-sc'>(
|
||
|
var table1, table2, table3;
|
||
|
|
||
|
table1 = Wavetable.sineFill(1024, [1,2,3]);
|
||
|
table2 = Signal.newClear.asWavetable;
|
||
|
table3 = Wavetable.sineFill(1024, Array.rand(64, 0.0, 1.0));
|
||
|
|
||
|
GetFileDialog.new(
|
||
|
{ arg ok, path;
|
||
|
var myPathName, myPathOnly;
|
||
|
if (ok,
|
||
|
{
|
||
|
myPathName = PathName.new(path);
|
||
|
myPathOnly = myPathName.pathOnly;
|
||
|
("writing files tables1-3 to"+myPathOnly).postln;
|
||
|
table1.write(myPathOnly ++ "table1");
|
||
|
table2.write(myPathOnly ++ "table2");
|
||
|
table3.write(myPathOnly ++ "table3");
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
)
|
||
|
)</pre>
|
||
|
|
||
|
<p><div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/PathName.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/PathName.schelp</a><br>link::Classes/PathName::<br></div></div></body></html>
|