Fix: compileSdk를 34로 낮추고 FTPFileSystem final 필드 버그 수정

- Android Gradle Plugin 7.1.3과 호환 문제로 compileSdk 36 → 34로 변경
- targetSdk도 34로 변경
- FTPFileSystem에서 final 필드 rootDirectory에 두 번 할당하는 버그 수정
  * getDefaultRootDirectory() 헬퍼 메서드로 로직 분리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-01 04:11:31 +09:00
parent 74bf67a9b2
commit 710ec15fb1
3 changed files with 47 additions and 12 deletions

13
.idea/deviceManager.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DeviceTable">
<option name="columnSorters">
<list>
<ColumnSorterState>
<option name="column" value="Name" />
<option name="order" value="ASCENDING" />
</ColumnSorterState>
</list>
</option>
</component>
</project>

View File

@@ -3,12 +3,12 @@ plugins {
}
android {
compileSdk 36
compileSdk 34
defaultConfig {
applicationId "be.gyu.android.server.ftp"
minSdk 21
targetSdk 36
targetSdk 34
versionCode 1
versionName "1.0"

View File

@@ -17,25 +17,47 @@ public class FTPFileSystem {
private File currentDirectory;
public FTPFileSystem() {
// Use external storage public directory as root
// In production, you might want to use app-specific directory or allow user to choose
File externalStorage = Environment.getExternalStorageDirectory();
this.rootDirectory = new File(externalStorage, "FTPServer");
this(null);
}
// Create root directory if it doesn't exist
if (!rootDirectory.exists()) {
if (rootDirectory.mkdirs()) {
Log.i(TAG, "Root directory created: " + rootDirectory.getAbsolutePath());
public FTPFileSystem(String rootDirectoryPath) {
if (rootDirectoryPath != null && !rootDirectoryPath.isEmpty()) {
// Use user-specified directory
File userDir = new File(rootDirectoryPath);
if (userDir.exists() && userDir.isDirectory()) {
this.rootDirectory = userDir;
Log.i(TAG, "Using user-specified root: " + rootDirectory.getAbsolutePath());
} else {
Log.w(TAG, "Failed to create root directory, using external storage root");
this.rootDirectory = externalStorage;
Log.w(TAG, "User-specified directory does not exist: " + rootDirectoryPath);
this.rootDirectory = getDefaultRootDirectory();
}
} else {
// Use default directory
this.rootDirectory = getDefaultRootDirectory();
}
this.currentDirectory = rootDirectory;
Log.d(TAG, "File system initialized. Root: " + rootDirectory.getAbsolutePath());
}
private File getDefaultRootDirectory() {
File externalStorage = Environment.getExternalStorageDirectory();
File ftpServerDir = new File(externalStorage, "FTPServer");
// Create root directory if it doesn't exist
if (!ftpServerDir.exists()) {
if (ftpServerDir.mkdirs()) {
Log.i(TAG, "Root directory created: " + ftpServerDir.getAbsolutePath());
return ftpServerDir;
} else {
Log.w(TAG, "Failed to create root directory, using external storage root");
return externalStorage;
}
} else {
return ftpServerDir;
}
}
public String getCurrentPath() {
String relativePath = getRelativePath(currentDirectory);
return relativePath.isEmpty() ? "/" : "/" + relativePath;