alt.rootDir

Used to get the full root directory of the resource that this is called inside of.

Useful for writing content to the server specific resource folder if necessary.

Returns a string.

Declaration

alt.rootDir: string

Usage

const directory = alt.rootDir;

Real World Example

import * as fs from 'fs';
import * as path from 'path';

const directory = alt.rootDir;
const textFilePath = path.join(directory, 'test.txt');

fs.appendFileSync(textFilePath, 'hello world');

These examples assume you have imported alt from alt-server.

results matching ""

    No results matching ""