love.filesystem (Русский)

Предоставляет интерфейс к файловой системе пользователя.

Этот модуль предоставляет доступ к файлам, находящимся только в двух местах:

  • Коренная папка .love-файла. (Не включая директорию).
  • Коренная папка директории сохранения.

Каждой игре предоставляется одна директория в системе, где файлы могут быть сохранены через love.filesystem. Эти каталоги обычно можно найти по таким путям:

  • Windows XP: C:\Documents and Settings\user\Application Data\Love\ or %appdata%\Love\
  • Windows Vista and 7: C:\Users\user\AppData\Roaming\LOVE or %appdata%\Love\
  • Linux: /home/user/.love/ or ~/.love/
  • mac: /Library/Application Support/LOVE/

Файлы, которые открываются для записи или добавления, всегда будут созданы в директории сохранения. То же самое касается других операций, которые что-либо записывают или создают в файловой системе, например MkDir.

Файлы, которые открываются для чтения, сначала будут искаться в каталоге сохранения, а затем в корневой папке игры (в таком порядке). Таким образом, если файл с определенным именем (или путь) существует в .love-файле и папке для сохранения, то файл в папке сохранения будет более приоритетным.

Примечание: Все все пути относительны .love-файла и директории сохранения. (за исключением вызовов get*Directory())

В настоящее время, вы должны создавать папку сохранения с помощью love.filesystem.setIdentity.

Типы

DroppedFileRepresents a file dropped from the window.
FileRepresents a file on the filesystem.
FileDataData representing the contents of a file.

Функции

love.filesystem.appendAppend data to an existing file.
love.filesystem.areSymlinksEnabledGets whether love.filesystem follows symbolic links.
love.filesystem.createDirectoryCreates a directory.
love.filesystem.enumerateReturns all the files and subdirectories in the directory.
love.filesystem.existsCheck whether a file or directory exists.
love.filesystem.getAppdataDirectoryReturns the application data directory (could be the same as getUserDirectory)
love.filesystem.getCRequirePathGets the filesystem paths that will be searched for c libraries when require is called.
love.filesystem.getDirectoryItemsReturns all the files and subdirectories in the directory.
love.filesystem.getIdentityGets the write directory name for your game.
love.filesystem.getInfoGets information about the specified file or directory.
love.filesystem.getLastModifiedGets the last modification time of a file.
love.filesystem.getRealDirectoryGets the absolute path of the directory containing a filepath.
love.filesystem.getRequirePathGets the filesystem paths that will be searched when require is called.
love.filesystem.getSaveDirectoryGets the full path to the designated save directory.
love.filesystem.getSizeGets the size in bytes of a file.
love.filesystem.getSourceReturns the full path to the .love file or directory.
love.filesystem.getSourceBaseDirectoryReturns the full path to the directory containing the .love file.
love.filesystem.getUserDirectoryReturns the path of the user's directory
love.filesystem.getWorkingDirectoryGets the current working directory.
love.filesystem.initInitializes love.filesystem, will be called internally, so should not be used explicitly.
love.filesystem.isDirectoryCheck whether something is a directory.
love.filesystem.isFileCheck whether something is a file.
love.filesystem.isFusedGets whether the game is in fused mode or not.
love.filesystem.isSymlinkGets whether a filepath is actually a symbolic link.
love.filesystem.linesIterate over the lines in a file.
love.filesystem.loadLoads a Lua file (but does not run it).
love.filesystem.mkdirCreates a directory.
love.filesystem.mountMounts a zip file or folder in the game's save directory for reading.
love.filesystem.mountFullPathMounts a full platform-dependent path to a zip file or folder for reading or writing in love.filesystem.
love.filesystem.newFileCreates a new File object.
love.filesystem.newFileDataCreates a new FileData object from a file on disk, or from a string in memory.
love.filesystem.openFileOpens a new File object, which represents an existing or new file on disk.
love.filesystem.readRead the contents of a file.
love.filesystem.removeRemoves a file (or directory).
love.filesystem.setCRequirePathSets the filesystem paths that will be searched for c libraries when require is called.
love.filesystem.setIdentitySets the write directory for your game.
love.filesystem.setRequirePathSets the filesystem paths that will be searched when require is called.
love.filesystem.setSourceSets the source of the game, where the code is present. Used internally.
love.filesystem.setSymlinksEnabledSets whether love.filesystem follows symbolic links.
love.filesystem.unmountUnmounts a zip file or folder previously mounted with love.filesystem.mount.
love.filesystem.unmountFullPathUnmounts a zip file or folder previously mounted with love.filesystem.mountFullPath.
love.filesystem.writeWrite data to a file.

Перечисления

FileDecoderHow to decode a given FileData.
FileModeThe different modes you can open a File in.
FileTypeThe type of a file.
LoadModePossible load modes for love.filesystem.load.

Смотрите также

Другие языки