Invalid Workspace Archive

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Invalid Workspace Archive

Post by kengrubb »

I have been encountering this from time to time since upgrading to TP 7.1.0

I get the error message when opening a Workspace file (*.tws), and the Workspace gets trashed.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

I saved off my Workspaces so I didn't lose them. Error message I'm seeing, which is reproducible, when I double click the Workspace (.tws) is:

Unexpected problem loading workspace archive.
Cannot restore full workspace.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

If I open up TextPad with another Workspace, then open this Workspace via File, Workspace, Open or the hotlist, then it's fine. However, once the Workspace updates, it's corrupted.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

One thing I can observe would be that I believe the corrupted Workspace was created and/or saved under TP 7.0.9 running out of C:\Program Files (x86) whereas TP 7.1.0 installed in C:\Program Files
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

Still periodically getting these. Workspaces are somehow getting corrupted.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

This is happening now daily, and it's quite maddening.
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

OK, I may have figured out the pattern.

It appears that if one has a Workspace with a file open in it, and the file gets moved to a different folder, either when TP closes, or when TP opens again, the Workspace becomes invalid because it has a link to a file which no longer exists.
(2[Bb]|[^2].|.[^Bb])

That is the question.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

I believe this happened to me once with TextPad 7, although I haven't been able to reproduce it.

I have a Perl script that lists the file names in a TextPad workspace file. I keep my large and growing collection of workspace files in a single directory, and I use this script to find out in which workspace I long ago edited some particular half-forgotten file. Might it be useful to you (or anyone else)?
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

It would be useful to me, and I suspect useful to others
(2[Bb]|[^2].|.[^Bb])

That is the question.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

The script twsfiles.pl below assumes that your workspaces are in the directory C:/t .

To list all the files in workspace aWorkspace enter
perl twsfiles.pl aWorkspace.tws

To list all the files in all workspaces matching wildcard expression wildcard_expression enter
perl twsfiles.pl wildcard_expression

To list all the files in all workspaces enter
perl twsfiles.pl

Code: Select all

use warnings ;
use strict   ;

use Encode ;
use File::Glob ':glob' ;

my $twsDir = 'C:/t' ;

chdir $twsDir or
  die "Can't change to directory \"$twsDir\": $!\n" ;

my @twsNames = map { bsd_glob $_ } ( @ARGV ? @ARGV : ( '*.tws' ) ) ;

for my $twsName ( @twsNames )
{
  if ( -f $twsName && $twsName =~ /\.tws$/ )
  {
    print "\n$twsName\n" ;

    if ( open TWS, $twsName )
    {
      local $/ = undef ;
      my $tws = <TWS> ;
      close TWS ;

      if ( ( ord substr $tws, 2, 1 ) >= 7 )  # new-style (UTF-16) workspace file
      {
        my @docNames = $tws =~ /[EB]COD.{5}((?:..)+?)\x00\x00/gs ;

        for my $docName ( sort @docNames )
        {
          print +( decode 'ucs-2le', $docName ), "\n" ;
        }
      }
      else                                   # old-style (ASCII) workspace file
      {
        my @docNames = $tws =~ /[EB]COD..(.+?)\x00/gs ;

        for my $docName ( sort @docNames )
        {
          print "$docName\n" ;
        }
      }
    }
    else
    {
      warn "Can't open \"$twsName\".\n" ;
    }
  }
  elsif ( -f $twsName )
  {
    print "\n\"$twsName\" is not a workspace file.\n" ;
  }
  else
  {
    print "\n\"$twsName\" doesn't exist.\n" ;
  }
}
Post Reply