$pushd and $popd: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (minor cleanup)
No edit summary
Line 1: Line 1:
Adds a search path for source files onto a stack. Used to set the current working directory.
The [[QC command]]s '''<code>$pushd</code>''' and '''<code>$popd</code>''' 'push' and 'pop' directories to and from the QC's active folder. Multiple <code>$pushd</code> can be nested inside each other, so long as there are a corresponding number of <code>$popd</code>.


== Syntax ==
== Syntax ==


  $pushd ".\path\to\files\"
  $pushd <path>
...
$popd


The default working directory is the folder of the .qc file. The <code>$pushd</code> must be met with a <code>[[$popd]]</code>. Multiple <code>$pushd</code> can be nested inside each other.
== Example ==


* The path should be a full or relative path on the file system.
  $modelname "props\fan.mdl"
 
  $cdmaterials "models\props\"
== Example ==
  $model fan "fan.smd"
  $modelname "props/fan.mdl"
  $cdmaterials "models/props/"
  '''$pushd''' ".\new animations\"
  $model "Fan" "fan.smd"
  $sequence rotate "rotate.smd"
  '''$pushd ".\new animations\"'''
  '''$popd'''
  $sequence "rotate" "rotate.smd"
  $popd
  $sequence idle "idle.smd"
  $sequence "idle" "idle.smd"


[[Category:QC Commands|pushd]]
[[Category:QC Commands|pushd]]

Revision as of 05:47, 9 January 2009

The QC commands $pushd and $popd 'push' and 'pop' directories to and from the QC's active folder. Multiple $pushd can be nested inside each other, so long as there are a corresponding number of $popd.

Syntax

$pushd <path>
...
$popd

Example

$modelname	"props\fan.mdl"
$cdmaterials	"models\props\"
$model	fan	"fan.smd"

$pushd	".\new animations\"
$sequence	rotate	"rotate.smd"
$popd

$sequence	idle	"idle.smd"