Aparajita,

I hope you don't take it amiss, if I mess around with your code, but I've
taken a look into the broken New Circuit Action of your Texmate Bundle and
found it easy to fix. Actually it needs just 2 lines of code altered in the
new_circuit.rb file of the bundle.

Here is the beginning of the file:

#!/usr/bin/env ruby

require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'

circuitPath = ENV['TM_SELECTED_FILE']

if not circuitPath then
    print "Please select a folder or a file in whose folder you want to
create the circuit"
    exit(206)
end

openSwitch = false
circuitDir = ""

# If it isn't a directory, get the directory name
if not test(?d, circuitPath) then
    circuitPath = File.dirname(circuitPath)
end

# Ask for the circuit name
result = TextMate::UI.request_string :title => "New Circuit", :prompt =>
"Enter the circuit name:"

# Replace this
# if result.readline.chomp == "1" then  # OK clicked
    # circuitName = result.readline.chomp
    # result.close
    
# with this    
if result != nil then  # OK clicked
    circuitName = result
    

Just replace the bottom parts as indicated in the comment.




Furthermore I found, the action only updates the fbx_circuits.a4d, if it is
in a subfolder of the Textmate project folder, not if it is in the root of
the project folder. This is because you exit the loop for detecting the
fbx_circuits.a4d file as soon as you reach the project folder without
testing it's root content:

    # Now search up to the project root, looking for fbx_circuits.a4d
    curDir = circuitDir
    projectDir = ENV['TM_PROJECT_DIRECTORY']
    found = 0

    until curDir == projectDir
        if test(?f, "#{curDir}/fbx_circuits.a4d") then
            found = 1
            break
        else
            # Go up one directory
            curDir = File.dirname(curDir)
        end
    end

As a dirty hack I've added a second file test in the else clause:

    # Now search up to the project root, looking for fbx_circuits.a4d
    curDir = circuitDir
    projectDir = ENV['TM_PROJECT_DIRECTORY']
    found = 0

    until curDir == projectDir
        if test(?f, "#{curDir}/fbx_circuits.a4d") then
            found = 1
            break
        else
            # Go up one directory
            curDir = File.dirname(curDir)
            if test(?f, "#{curDir}/fbx_circuits.a4d") then
                found = 1
                break
            end
        end
    end


Pete


_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/

Reply via email to