back_duo 0.0.3 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/back_duo.rb +42 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2a3901fe47374ebeeea98948831edaa1f0195a1b3f9618f033c1d0dedaeb670
4
- data.tar.gz: bff72d093de21e9745cadf747af41862fb0fb95721ef35f8f91a479b4d6d2ced
3
+ metadata.gz: 7916ce734f0e05a74b575e9446f84c42afc4f52b275486efcd2aeb41d095802c
4
+ data.tar.gz: 998398504d261dffdb97f8eb4b00ce4b171ccfeadbc749fb0ecb2f9c8c6e0484
5
5
  SHA512:
6
- metadata.gz: b99b11d804425f37d2d76cae67f6879642d079f551d18d50ed725deca149028c489b6784e3880c757a443182c276d697a043463768b1d4108d9ca1e476fd3919
7
- data.tar.gz: e75c0b17a0967df1f6cbc0a38edf4c43d65cceec367ca86697f33c4994aa71a9728dacc00ab7137e27b94982809a2c4f782ac2a074a2cf98f20c386afd34b6de
6
+ metadata.gz: 7a1c33b80925d74b80822756d32c957fc4711d6795f8155165342a3b83b0506b899e6318816f701fc928676e224e0cc90ffc880380350a9d006274896392f213
7
+ data.tar.gz: 9ab798d4ef273b690532db51d7d877f0eb779e20c7bbd24f52c63fd3a6de99b8070bfab24c890724a778e8814036004287699b9f17c8b6014c3334051aa52b33
data/lib/back_duo.rb CHANGED
@@ -2140,18 +2140,33 @@ class Wordpress
2140
2140
  }
2141
2141
  button('폴더째로불러오기'){
2142
2142
  stretchy false
2143
- on_clicked{
2144
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2145
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
2146
- if file == '.' or file == '..'
2147
-
2148
- else
2149
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
2150
- @data['내용설정']['내용'] << [false, file, file_data]
2143
+ on_clicked {
2144
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
2145
+
2146
+ # 경로가 유효한지 확인
2147
+ if Dir.exist?(path)
2148
+ Dir.entries(path).each do |file|
2149
+ if file == '.' or file == '..'
2150
+ next
2151
+ else
2152
+ begin
2153
+ # 파일을 열고 내용을 읽어서 추가
2154
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
2155
+ @data['내용설정']['내용'] << [false, file, file_data]
2156
+ rescue => e
2157
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
2158
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
2159
+ end
2160
+ end
2151
2161
  end
2162
+
2163
+ # 내용 배열에서 마지막 빈 항목 제거
2164
+ @data['내용설정']['내용'] << []
2165
+ @data['내용설정']['내용'].pop
2166
+ else
2167
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
2168
+ puts "경로가 존재하지 않습니다: #{path}"
2152
2169
  end
2153
- @data['내용설정']['내용'] << []
2154
- @data['내용설정']['내용'].pop
2155
2170
  }
2156
2171
  }
2157
2172
  }
@@ -2243,17 +2258,27 @@ class Wordpress
2243
2258
  }
2244
2259
  button('폴더째로불러오기'){
2245
2260
  stretchy false
2246
- on_clicked{
2261
+ on_clicked {
2247
2262
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
2248
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s).each do |file|
2249
- if file == '.' or file == '..'
2250
2263
 
2251
- else
2252
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
2264
+ # 경로가 유효한지 확인
2265
+ if Dir.exist?(path)
2266
+ Dir.entries(path).each do |file|
2267
+ if file == '.' or file == '..'
2268
+ next
2269
+ else
2270
+ # 폴더 내의 파일을 이미지 리스트에 추가
2271
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
2272
+ end
2253
2273
  end
2274
+
2275
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
2276
+ @data['이미지설정']['이미지'] << []
2277
+ @data['이미지설정']['이미지'].pop
2278
+ else
2279
+ # 경로가 존재하지 않으면 경고 메시지 출력
2280
+ puts "경로가 존재하지 않습니다: #{path}"
2254
2281
  end
2255
- @data['이미지설정']['이미지'] << []
2256
- @data['이미지설정']['이미지'].pop
2257
2282
  }
2258
2283
  }
2259
2284
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: back_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com