Skip to content

The Data Folder

AutoPlay Media Studio can publish a project with its data folder, AutoPlay, under another name (the Obscure data folder setting). When you do that, paths in your scripts such as "AutoPlay\\Images\\logo.png" have to name the new folder instead.

autoplay2c can do that for you while it compiles:

a2c build MyProject.autoplay --data-folder data

In the application, turn on Rename the data folder in scripts on the Project page and fill in the New name.

What Is Replaced

AutoPlay\ and AutoPlay/, in any case, at the start of a path or right after a \ or /, and only in string literals.

local a = "AutoPlay\\Images\\logo.png";      -- becomes "data\\Images\\logo.png"
local b = _SourceFolder .. "\\AutoPlay\\Docs"; -- becomes "\\data\\Docs"
local c = "MyAutoPlayFile.txt";              -- unchanged: not at the start of a path
-- AutoPlay\Images in a comment is unchanged

Comments, variable names and other text are never touched. A path that's built from several pieces, such as "AutoPlay" .. "\\", is left alone too, because no single string holds the whole folder name.

A replaced string keeps its lines, so the line numbers in errors don't move.

Tip

If the project publishes its data folder under another name than the one you give, autoplay2c warns you about it. A mismatch like that means your scripts look in a folder that won't exist after publishing.

Technical details

The replacement works on the string tokens of the parsed source, not on the text of the scripts. That's why comments and names are safe, and why a string split over a concatenation isn't changed. The previous version of autoplay2c replaced the text of the whole source instead.