cafe_buy_duo 0.0.10 → 0.0.11

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/cafe_buy_duo.rb +45 -22
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69f822498d2a7c548092090ebb42cf643ab3f1e17075a1f61a66542abfe76e0c
4
- data.tar.gz: 9bbe8d88f50c23137a97d98fc0021a30454683f0ae605e561541f59aca31383f
3
+ metadata.gz: 62b5bdbc76a52f74d44f933c96ca76668575b5ad009d7d6f565c4915dee8f846
4
+ data.tar.gz: 4b23f2d5714c23cbc8df08e04c94fc7c92f7da6bf2eae3bdbb7a6389b9601215
5
5
  SHA512:
6
- metadata.gz: 4995b53d0a52ba782f51def5fa609766f940d06be13ae0afe1b620524bac23c417edbbf5a482d6bce83cd45f5a443b375420d91790ca0431fa73335cd5e07849
7
- data.tar.gz: b6c0dc2a769b615c12d10218bf113c9e80a3d41d45656f0f2238655692b7ea6d6bfcc951df15dcbf887e3ad6abc81bf4ce2a398da3dc1ae84ade67cdaf2c62f7
6
+ metadata.gz: 5de9d54b03e3777c2f9f9d4fff197c4a6a8c66fc13b0967a116b06caadc62f03013d0c156857bb85dcd1481fd57e83fc32faa13ba4c2c8d783e87a080586d86a
7
+ data.tar.gz: 30e2304ac80f250ce69be1f4bbb8d3e8c94f062bc9cac1f981f2518f100ba01459509c1826b1444dbc31a2198e5c6583f8c999e0f1d149de524c83bf2a93639a
data/lib/cafe_buy_duo.rb CHANGED
@@ -4122,20 +4122,34 @@ class Wordpress
4122
4122
  stretchy false
4123
4123
  text "내용폴더경로 ex)C:\\내용\\폴더1"
4124
4124
  }
4125
- button('폴더째로 불러오기'){
4126
-
4127
- on_clicked{
4128
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4129
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
4130
- if file == '.' or file == '..'
4125
+ button('폴더째로 불러오기') {
4126
+ on_clicked {
4127
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
4131
4128
 
4132
- else
4133
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
4134
- @data['내용설정']['내용'] << [false, file, file_data]
4129
+ # 경로가 유효한지 확인
4130
+ if Dir.exist?(path)
4131
+ Dir.entries(path).each do |file|
4132
+ if file == '.' or file == '..'
4133
+ next
4134
+ else
4135
+ begin
4136
+ # 파일을 열고 내용을 읽어서 추가
4137
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
4138
+ @data['내용설정']['내용'] << [false, file, file_data]
4139
+ rescue => e
4140
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
4141
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
4142
+ end
4143
+ end
4135
4144
  end
4145
+
4146
+ # 내용 배열에서 마지막 빈 항목 제거
4147
+ @data['내용설정']['내용'] << []
4148
+ @data['내용설정']['내용'].pop
4149
+ else
4150
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
4151
+ puts "경로가 존재하지 않습니다: #{path}"
4136
4152
  end
4137
- @data['내용설정']['내용'] << []
4138
- @data['내용설정']['내용'].pop
4139
4153
  }
4140
4154
  }
4141
4155
  }
@@ -4220,19 +4234,28 @@ class Wordpress
4220
4234
  stretchy false
4221
4235
  text "사진폴더경로 ex)C:\\사진\\폴더2"
4222
4236
  }
4223
- button('폴더째로불러오기'){
4224
-
4225
- on_clicked{
4226
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4227
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
4228
- if file == '.' or file == '..'
4229
-
4230
- else
4231
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
4237
+ button('폴더째로 불러오기') {
4238
+ on_clicked {
4239
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
4240
+
4241
+ # 경로가 유효한지 확인
4242
+ if Dir.exist?(path)
4243
+ Dir.entries(path).each do |file|
4244
+ if file == '.' or file == '..'
4245
+ next
4246
+ else
4247
+ # 폴더 내의 파일을 이미지 리스트에 추가
4248
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
4249
+ end
4232
4250
  end
4251
+
4252
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
4253
+ @data['이미지설정']['이미지'] << []
4254
+ @data['이미지설정']['이미지'].pop
4255
+ else
4256
+ # 경로가 존재하지 않으면 경고 메시지 출력
4257
+ puts "경로가 존재하지 않습니다: #{path}"
4233
4258
  end
4234
- @data['이미지설정']['이미지'] << []
4235
- @data['이미지설정']['이미지'].pop
4236
4259
  }
4237
4260
  }
4238
4261
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com