VictoriaFreSh 2024.9.16 → 2024.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/victoriafresh.rb +30 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1b4715d21e2d74203453ae9563d9dcfc25d5824ce9944b9272d3090197e5de8
4
- data.tar.gz: 00322e417b47835c4d5fb516ad2f1e6798dac2639f7f621e80b324904a28519d
3
+ metadata.gz: 6e0b92b20d099ee3450a94adaae6d3ae6cbba886548bb902bc02f9d2fe7d85a0
4
+ data.tar.gz: 06e05bd4399e4d9f5bee76458e1debed3f94509654d8d386613ada9f88d4c7ae
5
5
  SHA512:
6
- metadata.gz: aab347f0afeb0768e222d059e656f1232cbc4dc9b153177e165913fa6a0c92cb0343807f4c42358808aa8165d269f70abe057898fde38b0fb9ad2856278da860
7
- data.tar.gz: bed7c8c806eb34743710e07eb37267c4caf979f900fe4716ee39a48a3f39879661c5bb98bf4bfcf6607c327b5c55822f1aee1660b92e141679fdd5b62796c7bb
6
+ metadata.gz: d3fd6678851937db82070f655b63ac3e95a930bf23ae652006c7d9054cea99a4d1dbe1cbb633acec40cd629ad2e1eb4ccaf8a82c302c399f322bff73d8995d1d
7
+ data.tar.gz: 418f0848f48210c0ca5fc325b7721e9a8b238dd3e7c390552a678056137739a5108ba29094b3dd0c3d6e78f4f436dff6f8127ada84950147f889ea838acb4b70
data/lib/victoriafresh.rb CHANGED
@@ -336,7 +336,7 @@ class VictoriaFresh
336
336
  end #if (bufferLength>=@diskFlushSize) #缓冲区总长度已经超过需要的文件长度
337
337
 
338
338
  if (isFinalPart) #是最后一部分
339
- @contentString = @contentPartArray.join #重组成整个字符串
339
+ @contentString = @contentPartArray.join #重组成整个字符串
340
340
 
341
341
  @contentPartArray.clear #清空字符串数组
342
342
  @bufferLength=0 #缓冲区长度归零
@@ -345,19 +345,35 @@ class VictoriaFresh
345
345
 
346
346
  @contentString="" #字符串清空
347
347
 
348
- if (@diskMultiFile) #多个磁盘文件
349
- @diskWriteFileObject=File.new(@diskFileName+@currentDiskFlushSuffix.to_s+'.v', 'wb') #打开文件
350
-
351
- @currentDiskFlushSuffix=@currentDiskFlushSuffix+1 #增加计数
352
-
353
- @diskWriteFileObject.syswrite(contentToWrite) #写入内容
354
-
355
- @diskWriteFileObject.close
356
- else #单个磁盘文件
357
- @diskWriteFileObject.syswrite(contentToWrite) #写入内容
358
-
359
- @diskWriteFileObject.close #关闭文件
360
- end #if (@diskMultiFile) #多个磁盘文件
348
+ if (@diskMultiFile) #多个磁盘文件
349
+ begin
350
+ # 打开文件
351
+ @diskWriteFileObject = File.new("#{@diskFileName}#{@currentDiskFlushSuffix}.v", 'wb')
352
+
353
+ # 增加计数
354
+ @currentDiskFlushSuffix += 1
355
+
356
+ # 写入内容
357
+ @diskWriteFileObject.syswrite(contentToWrite)
358
+
359
+ # 关闭文件
360
+ @diskWriteFileObject.close
361
+ rescue Errno::EACCES => e
362
+ # 处理权限不足的情况
363
+ puts "Error: Unable to create or write to the file #{@diskFileName}#{@currentDiskFlushSuffix}.v - Permission denied."
364
+ puts e.message
365
+ raise # 重新引发异常
366
+ rescue StandardError => e
367
+ # 处理其他标准错误
368
+ puts "Error: An error occurred while creating or writing to the file #{@diskFileName}#{@currentDiskFlushSuffix}.v."
369
+ puts e.message
370
+ raise # 重新引发异常
371
+ end
372
+ else #单个磁盘文件
373
+ @diskWriteFileObject.syswrite(contentToWrite) #写入内容
374
+
375
+ @diskWriteFileObject.close #关闭文件
376
+ end #if (@diskMultiFile) #多个磁盘文件
361
377
  end #if (isFinalPart) #是最后一部分
362
378
  end #if (@diskFlush) #要做磁盘写入
363
379
  end #contentString= assessDiskFlush(contentString) #考虑是否要向磁盘先输出内容
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VictoriaFreSh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2024.9.16
4
+ version: 2024.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai