Skip to content

Conversation

tpimh
Copy link

@tpimh tpimh commented Sep 5, 2025

PHYSFS_getUserDir() was deprecated for a long time, and given a deprecation warning:

love/src/modules/filesystem/physfs/Filesystem.cpp: In member function ‘virtual std::string love::filesystem::physfs::Filesystem::getFullCommonPath(love::filesystem::Filesystem::CommonPath)’:
love/src/modules/filesystem/physfs/Filesystem.cpp:720:62: warning: ‘const char* PHYSFS_getUserDir()’ is deprecated [-Wdeprecated-declarations]
  720 |                 fullPaths[path] = normalize(PHYSFS_getUserDir());
      |                                             ~~~~~~~~~~~~~~~~~^~
In file included from love/src/modules/filesystem/physfs/File.h:29,
                 from love/src/modules/filesystem/physfs/Filesystem.cpp:29:
love/src/libraries/physfs/physfs.h:820:25: note: declared here
  820 | PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED;
      |                         ^~~~~~~~~~~~~~~~~

The warning about the deprecated function comes up only on Linux and Android (reported: love2d/love-android#113 and love2d/love-android#146). It's unlikely that this function is going to be removed in physfs 3.x, and even if it is removed from the next release, LÖVE is using modified source of the library and can keep a copy of this function.

I think it's safe to just disable the deprecation warning.

@slime73
Copy link
Member

slime73 commented Sep 5, 2025

I'd rather not modify third party libraries unless it's absolutely necessary. Were you running into a specific problem that this solves?

@tpimh
Copy link
Author

tpimh commented Sep 5, 2025

PhysFS in LÖVE is already a modified version if we compare it to 3.2.0 release:

  1. Workaround for Windows 7 runtime compatibility: 444ab63
  2. Fix compile error when targetting Windows ARM64: cfda1f5
  3. mountRW and friends: icculus/physfs@main...slime73:mountRW

I guess another small change won't hurt. The specific problem that this solves is suppressing the deprecation warning. It can also be supressed with #pragma without modifying the third-party library code, but since this code is already modified in this project, what I did seems to be a much cleaner solution.

@slime73
Copy link
Member

slime73 commented Sep 14, 2025

If we want to get rid of the warning, I think I'd rather remove calls to the function (perhaps by replacing them with OS-specific calls instead).

@tpimh
Copy link
Author

tpimh commented Sep 15, 2025

__PHYSFS_platformCalcUserDir() from physfs_platform_posix.c and physfs_platform_windows.c seems solid, and can be just copied, but then again, it would be just duplicated code which in my opinion is worse than a harmless warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants