@capacitor/filesystem 6.0.0-nightly-20231207T150520.0 → 6.0.0-nightly-20231211T150530.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorFilesystem.podspec +1 -1
- package/Package.swift +28 -0
- package/android/build.gradle +1 -1
- package/ios/{Plugin → Sources/FilesystemPlugin}/FilesystemPlugin.swift +27 -9
- package/ios/Tests/FilesystemPluginTests/FilesystemPluginTests.swift +12 -0
- package/package.json +6 -4
- package/ios/Plugin/FilesystemPlugin.h +0 -10
- package/ios/Plugin/FilesystemPlugin.m +0 -21
- package/ios/Plugin/Info.plist +0 -24
- /package/ios/{Plugin → Sources/FilesystemPlugin}/Filesystem.swift +0 -0
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.homepage = 'https://capacitorjs.com'
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
|
-
s.source_files = 'ios/
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'filesystem/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorFilesystem",
|
|
6
|
+
platforms: [.iOS(.v13)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "FilesystemPlugin",
|
|
10
|
+
targets: ["FilesystemPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor6-spm-test.git", branch: "main")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "FilesystemPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor6-spm-test"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor6-spm-test")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/FilesystemPlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "FilesystemPluginTests",
|
|
25
|
+
dependencies: ["FilesystemPlugin"],
|
|
26
|
+
path: "ios/Tests/FilesystemPluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -15,7 +15,7 @@ buildscript {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
dependencies {
|
|
18
|
-
classpath 'com.android.tools.build:gradle:8.2.0
|
|
18
|
+
classpath 'com.android.tools.build:gradle:8.2.0'
|
|
19
19
|
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
|
20
20
|
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
|
|
21
21
|
}
|
|
@@ -6,7 +6,25 @@ import Capacitor
|
|
|
6
6
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
7
|
*/
|
|
8
8
|
@objc(FilesystemPlugin)
|
|
9
|
-
public class FilesystemPlugin: CAPPlugin {
|
|
9
|
+
public class FilesystemPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
+
public let identifier = "FilesystemPlugin"
|
|
11
|
+
public let jsName = "Filesystem"
|
|
12
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
|
+
CAPPluginMethod(name: "readFile", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "writeFile", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "appendFile", returnType: CAPPluginReturnPromise),
|
|
16
|
+
CAPPluginMethod(name: "deleteFile", returnType: CAPPluginReturnPromise),
|
|
17
|
+
CAPPluginMethod(name: "mkdir", returnType: CAPPluginReturnPromise),
|
|
18
|
+
CAPPluginMethod(name: "rmdir", returnType: CAPPluginReturnPromise),
|
|
19
|
+
CAPPluginMethod(name: "readdir", returnType: CAPPluginReturnPromise),
|
|
20
|
+
CAPPluginMethod(name: "getUri", returnType: CAPPluginReturnPromise),
|
|
21
|
+
CAPPluginMethod(name: "stat", returnType: CAPPluginReturnPromise),
|
|
22
|
+
CAPPluginMethod(name: "rename", returnType: CAPPluginReturnPromise),
|
|
23
|
+
CAPPluginMethod(name: "copy", returnType: CAPPluginReturnPromise),
|
|
24
|
+
CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
|
|
25
|
+
CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
|
|
26
|
+
CAPPluginMethod(name: "downloadFile", returnType: CAPPluginReturnPromise)
|
|
27
|
+
]
|
|
10
28
|
private let implementation = Filesystem()
|
|
11
29
|
|
|
12
30
|
/**
|
|
@@ -190,15 +208,15 @@ public class FilesystemPlugin: CAPPlugin {
|
|
|
190
208
|
let directoryContents = try implementation.readdir(at: fileUrl)
|
|
191
209
|
let directoryContent = try directoryContents.map {(url: URL) -> [String: Any] in
|
|
192
210
|
let attr = try implementation.stat(at: url)
|
|
193
|
-
var ctime =
|
|
194
|
-
var mtime =
|
|
211
|
+
var ctime: UInt64 = 0
|
|
212
|
+
var mtime: UInt64 = 0
|
|
195
213
|
|
|
196
214
|
if let ctimeSeconds = (attr[.creationDate] as? Date)?.timeIntervalSince1970 {
|
|
197
|
-
ctime =
|
|
215
|
+
ctime = UInt64((ctimeSeconds * 1000).rounded())
|
|
198
216
|
}
|
|
199
217
|
|
|
200
218
|
if let mtimeSeconds = (attr[.modificationDate] as? Date)?.timeIntervalSince1970 {
|
|
201
|
-
mtime =
|
|
219
|
+
mtime = UInt64((mtimeSeconds * 1000).rounded())
|
|
202
220
|
}
|
|
203
221
|
return [
|
|
204
222
|
"name": url.lastPathComponent,
|
|
@@ -232,15 +250,15 @@ public class FilesystemPlugin: CAPPlugin {
|
|
|
232
250
|
do {
|
|
233
251
|
let attr = try implementation.stat(at: fileUrl)
|
|
234
252
|
|
|
235
|
-
var ctime =
|
|
236
|
-
var mtime =
|
|
253
|
+
var ctime: UInt64 = 0
|
|
254
|
+
var mtime: UInt64 = 0
|
|
237
255
|
|
|
238
256
|
if let ctimeSeconds = (attr[.creationDate] as? Date)?.timeIntervalSince1970 {
|
|
239
|
-
ctime =
|
|
257
|
+
ctime = UInt64((ctimeSeconds * 1000).rounded())
|
|
240
258
|
}
|
|
241
259
|
|
|
242
260
|
if let mtimeSeconds = (attr[.modificationDate] as? Date)?.timeIntervalSince1970 {
|
|
243
|
-
mtime =
|
|
261
|
+
mtime = UInt64((mtimeSeconds * 1000).rounded())
|
|
244
262
|
}
|
|
245
263
|
|
|
246
264
|
call.resolve([
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import FilesystemPlugin
|
|
3
|
+
|
|
4
|
+
final class FilesystemPluginTests: XCTestCase {
|
|
5
|
+
func testExample() throws {
|
|
6
|
+
// XCTest Documentation
|
|
7
|
+
// https://developer.apple.com/documentation/xctest
|
|
8
|
+
|
|
9
|
+
// Defining Test Cases and Test Methods
|
|
10
|
+
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/filesystem",
|
|
3
|
-
"version": "6.0.0-nightly-
|
|
3
|
+
"version": "6.0.0-nightly-20231211T150530.0",
|
|
4
4
|
"description": "The Filesystem API provides a NodeJS-like API for working with files on the device.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"android/src/main/",
|
|
11
11
|
"android/build.gradle",
|
|
12
12
|
"dist/",
|
|
13
|
-
"ios/
|
|
13
|
+
"ios/Sources",
|
|
14
|
+
"ios/Tests",
|
|
15
|
+
"Package.swift",
|
|
14
16
|
"CapacitorFilesystem.podspec"
|
|
15
17
|
],
|
|
16
18
|
"author": "Ionic <hi@ionicframework.com>",
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
],
|
|
30
32
|
"scripts": {
|
|
31
33
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
32
|
-
"verify:ios": "
|
|
34
|
+
"verify:ios": "xcodebuild build -scheme CapacitorFilesystem -sdk iphonesimulator17.0 -destination 'OS=17.0,name=iPhone 15'",
|
|
33
35
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
36
|
"verify:web": "npm run build",
|
|
35
37
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
@@ -79,5 +81,5 @@
|
|
|
79
81
|
"publishConfig": {
|
|
80
82
|
"access": "public"
|
|
81
83
|
},
|
|
82
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "79cbfe9ce185e540c3e62eca0e4f01dccfbda435"
|
|
83
85
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
//! Project version number for Plugin.
|
|
4
|
-
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
-
|
|
6
|
-
//! Project version string for Plugin.
|
|
7
|
-
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
-
|
|
9
|
-
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <Capacitor/Capacitor.h>
|
|
3
|
-
|
|
4
|
-
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
-
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
-
CAP_PLUGIN(FilesystemPlugin, "Filesystem",
|
|
7
|
-
CAP_PLUGIN_METHOD(readFile, CAPPluginReturnPromise);
|
|
8
|
-
CAP_PLUGIN_METHOD(writeFile, CAPPluginReturnPromise);
|
|
9
|
-
CAP_PLUGIN_METHOD(appendFile, CAPPluginReturnPromise);
|
|
10
|
-
CAP_PLUGIN_METHOD(deleteFile, CAPPluginReturnPromise);
|
|
11
|
-
CAP_PLUGIN_METHOD(mkdir, CAPPluginReturnPromise);
|
|
12
|
-
CAP_PLUGIN_METHOD(rmdir, CAPPluginReturnPromise);
|
|
13
|
-
CAP_PLUGIN_METHOD(readdir, CAPPluginReturnPromise);
|
|
14
|
-
CAP_PLUGIN_METHOD(getUri, CAPPluginReturnPromise);
|
|
15
|
-
CAP_PLUGIN_METHOD(stat, CAPPluginReturnPromise);
|
|
16
|
-
CAP_PLUGIN_METHOD(rename, CAPPluginReturnPromise);
|
|
17
|
-
CAP_PLUGIN_METHOD(copy, CAPPluginReturnPromise);
|
|
18
|
-
CAP_PLUGIN_METHOD(checkPermissions, CAPPluginReturnPromise);
|
|
19
|
-
CAP_PLUGIN_METHOD(requestPermissions, CAPPluginReturnPromise);
|
|
20
|
-
CAP_PLUGIN_METHOD(downloadFile, CAPPluginReturnPromise);
|
|
21
|
-
)
|
package/ios/Plugin/Info.plist
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
-
<key>CFBundleExecutable</key>
|
|
8
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
-
<key>CFBundleIdentifier</key>
|
|
10
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
-
<string>6.0</string>
|
|
13
|
-
<key>CFBundleName</key>
|
|
14
|
-
<string>$(PRODUCT_NAME)</string>
|
|
15
|
-
<key>CFBundlePackageType</key>
|
|
16
|
-
<string>FMWK</string>
|
|
17
|
-
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>1.0</string>
|
|
19
|
-
<key>CFBundleVersion</key>
|
|
20
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
-
<key>NSPrincipalClass</key>
|
|
22
|
-
<string></string>
|
|
23
|
-
</dict>
|
|
24
|
-
</plist>
|
|
File without changes
|