mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* Saving work * Move shit to engine * lord * merg * awa * bql is kill * forgot the fucking bike rack * bql is kill for real * pjb will kill me * aughfhbdj * yo ho here we go on my way to the MINES * a * adgddf * gdsgvfvxshngfgh * b * hfsjhghj * hbfdjjh * tf you mean i have to document it * follow C# standards * Assorted cleanup and documentation pass, minor bugfix in ValueRefParser. * Start porting old commands, remove that pesky prefix in favor of integrating with the shell. * Fix valueref up a bit, improve autocomplete for it. * e * Toolshed type system adventure. * a log * a * a e i o u * awa * fix tests * Arithmetic commands. * a * parse improvements --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using System;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Toolshed.Commands.Vfs;
|
|
|
|
/// <summary>
|
|
/// A simple base class for commands that work with the VFS and would like to manipulate the user's current location within the VFS.
|
|
/// </summary>
|
|
/// <seealso cref="UserVfsLocVariableName"/>
|
|
[PublicAPI]
|
|
public abstract class VfsCommand : ToolshedCommand
|
|
{
|
|
[Dependency] protected readonly IResourceManager Resources = default!;
|
|
|
|
/// <summary>
|
|
/// The name of the variable storing a <see cref="ResPath">ResPath?</see> representing the user's current VFS location.
|
|
/// </summary>
|
|
public const string UserVfsLocVariableName = "user_vfs_loc";
|
|
|
|
protected ResPath CurrentPath(IInvocationContext ctx) => ((ResPath?) ctx.ReadVar(UserVfsLocVariableName)) ?? ResPath.Root;
|
|
|
|
protected void SetPath(IInvocationContext ctx, ResPath path)
|
|
{
|
|
ctx.WriteVar(UserVfsLocVariableName, (ResPath?) path.Clean());
|
|
}
|
|
}
|