Path.GetFileNameWithoutExtension (Civ5 API)

From Civilization Modding Wiki
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


Function.png This function is a member of Path.

This is a static method, invoke it with a dot.


Obtains the filename without the extension for a given path This method returns the name of the file, minus extension, in a given path.


Usage

string Path.GetFileNameWithoutExtension(string path)


Returned Value

The name of the file in the path, minus the extension or an empty string on error.

Parameters

path: An absolute or relative path to a file.


Examples

local path = "C:\\temp\\foo.bar";
print(Path.GetFileNameWithoutExtension(path)); -- prints "foo"


Source code samples

Redundant occurences have been removed.

AdvancedSetup.lua

UI/FrontEnd/GameSetup/AdvancedSetup.lua
0714
name = Path.GetFileNameWithoutExtension(map.File);


GameSetupScreen.lua

UI/FrontEnd/GameSetup/GameSetupScreen.lua
0339
local mapName = Path.GetFileNameWithoutExtension(mapScriptFileName);
0343
mapName = Path.GetFileNameWithoutExtension(mapScriptFileName);


LoadMenu.lua

UI/FrontEnd/LoadMenu.lua
0353
name = Path.GetFileNameWithoutExtension(header.MapScript);
0507
return Path.GetFileNameWithoutExtension(file);


LoadReplayMenu.lua

UI/FrontEnd/LoadReplayMenu.lua
0148
local name = Path.GetFileNameWithoutExtension(g_FileList[g_iSelected]);
0414
local displayName = Path.GetFileNameWithoutExtension(v);


Lobby.lua

UI/FrontEnd/Multiplayer/Lobby.lua
0252
local serverMapFileName = Path.GetFileNameWithoutExtension(serverMapFile);
0258
local mapFileName = Path.GetFileNameWithoutExtension(row.FileName);
0282
name = Path.GetFileNameWithoutExtension(serverMapFile);


MPGameOptions.lua

UI/FrontEnd/Multiplayer/GameSetup/MPGameOptions.lua
0251
local fileTitle = Path.GetFileNameWithoutExtension(PreGame.GetMapScript());
0616
mapName = Path.GetFileNameWithoutExtension(v[1]);


SaveMenu.lua

UI/InGame/Menus/SaveMenu.lua
0309
name = Path.GetFileNameWithoutExtension(mapScript);



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.