Moving and renaming files
Rename or move a file or folder, and every path pointing to it is updated.
Rename or move a file or a folder in VS Code, and every path that points to it is updated in the same step. You don't have to search your mod for the old path.
How to use it
Rename a file or folder in the Explorer (F2, or right-click → Rename), or drag it to another folder. That's all.
The first time, VS Code asks whether to apply the extension's changes. This dialog is VS Code's own and it appears for every extension that changes files on a move. Tick Do not ask me again to skip it from then on.
What is updated
@includepaths, in.siiand.suifiles.- Every attribute that names a file:
model: "/vehicle/truck/my_truck/cabin.pmd",shadow_texture, sounds ("horn|/sound/truck/horn.soundref") and the rest. - The texture paths in
.matfiles, in both the game's format and the older one. - The texture names in text
.tobjfiles, as SCS Blender Tools exports them. - The sound bank in
.soundreffiles (source="/sound/truck/horns.bank#air"). The event after the#stays as it is, here and in.siifiles. - The relative paths written inside a file you move, so they keep pointing to the same files.
Moving a folder updates the paths to every file inside it.
How paths are written
- A path that starts with
/stays a/path. - A relative path stays relative while it can. The game's files never go up a
folder with
../, so a path that would need it is written from/instead.
For example, after renaming the folder vehicle/truck/my_truck/ to w900/, a
file that names a model inside it changes like this:
accessory_rim_data : my_hub.shub {
name: "My hub"
model: "/vehicle/truck/my_truck/hub.pmd"
model: "/vehicle/truck/w900/hub.pmd"
}
Review the changes
When a move changes paths in a few .sii or .sui files (up to 6, by default),
VS Code opens them without saving them, so you can look before you save.
.mat files are saved for you: see Saved for you. Each changed
line gets a mark
at the start of the line and on the scrollbar, in the same color git uses for
modified lines, so you can find them in a long file. Point at the line to see why
it changed.
The marks go away when you save or close the file, or when the line no longer holds the new path.
Saved for you
Renaming a folder can change dozens of files: a texture folder can be named in fifty
.mat files. Opening each one for you to save would bury your work in tabs, so some
are saved right away, the tabs the move opened are closed, and a notification tells
you how many files were updated:
.matfiles, always. They're usually written by SCS Blender Tools' converter, and there's nothing to review in them. This also means you can rename a texture folder without converting your models again.- Every file, when there are more than 6 of the other types.
Two things are never touched:
- Tabs you already had open stay open.
- Files with unsaved changes of your own are never saved for you: they stay open, with the new path in them, for you to save.
You can change all of this in the Settings, under File Moves:
| Setting | Default | What it does |
|---|---|---|
Auto Save (scs-intellisense.fileMoves.autoSave) | on | Uncheck to always leave the files open for review |
Always Save (scs-intellisense.fileMoves.alwaysSave) | .mat | The file types saved after every move. Add .tobj, for example |
Save Above (scs-intellisense.fileMoves.saveAbove) | 6 | Above this many files of the other types, they're saved too. 0 always saves |
Notify (scs-intellisense.fileMoves.notify) | on | The notification. The extension's log always records it |
What isn't updated
- Moves made outside VS Code, in the Windows Explorer or by another program: VS Code doesn't see them. Move your files from inside VS Code.
- Compiled
.tobjfiles: they're binary, so the extension can't change them. A.tobjwith a.ddsof the same name beside it is taken for a compiled one and not read, even if it's text. The ones SCS Blender Tools exports name a.tgaor.pnginstead, so they're read. - Paths that can't be written any more: a file moved out of your mod's folder.